solving the differential equation
Mostra commenti meno recenti
I want to solve the below equations. In these equations Q,Tp are variables, and italic underlined alphabets are constant. Also, Irr and Te are matrices with one row and 18 columns. I want to obtain Q and Tp as matrices with one row and 18 columns according to the amount of Irr and Te. I mean with the first element of Irr and Te, calculate the first elemnt of Tp and Q. My question is 'how can I solve these equations'? Would you please hep me?
dQ/dt=A * Irr + B * Te+ N Tp
if Q<C
Tp=D* Q
if E<Q<F
Tp=H
if Q>G
Tp=M* Q
4 Commenti
Walter Roberson
il 23 Apr 2022
Duplicate question.
Sam Chak
il 23 Apr 2022
Hi Ms. @Hannah Mohebi
There seem to be multiple questions related to the same problem as listed below:
Can you consolidate them and advise which one should we answer?
To get meaningful answer (rather than letting us to guess), please provide the mathematical functions for the following:
Hannah Mohebi
il 24 Apr 2022
Walter Roberson
il 25 Apr 2022
As I described in https://www.mathworks.com/matlabcentral/answers/1702300-solve-the-system-of-linear-equation#comment_2118045 you will need to use one of the ode*() routines with Event Functions in order to detect the boundary conditions. You will need to have the event function fire in crossing either direction, because an increasing value for one component of the 1 x 18 Q might happen to be accompanied by a decreasing value for another. Any one component might happen to wander back and forth over a boundary while the other components are changing.
Risposte (1)
Sam Chak
il 24 Apr 2022
Hi Ms. @Hannah Mohebi
You did not specify what happen in these two regions
and
. Furthermore, no useful info about other parameters in your specific differential equation. Anyhow, if Tp looks like this:

then you can write the ODE as such (assuming that other parameters are constants, not matrices):
function dydt = Hannah(t, y)
dydt = zeros(1,1);
A = 1;
Irr = 1;
B = -1;
Te = 1;
N = -1;
D = 1;
E = -1;
F = 1;
M = 1;
Q = y;
Tp = min(max(0, M*Q - F), D*Q - E);
dydt = A*Irr + B*Te + N*Tp;
end
and solve it using ode45:
Tspan = [0 10]; % simulation time
y0 = -3:0.5:3; % initial value
[t, y] = ode45(@Hannah, Tspan, y0);
plot(t, y, 'linewidth', 1.5)
grid on
xlabel('Time, t')
ylabel('Q(t)')
Results:

1 Commento
Torsten
il 24 Apr 2022
But all variables involved (Q,Tp,Irr,Te) are 1x18, not 1x1.
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!