solving the differential equation

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

Walter Roberson
Walter Roberson 2022년 4월 23일
Duplicate question.
Sam Chak
Sam Chak 2022년 4월 23일
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
Hannah Mohebi 2022년 4월 24일
I tried to explain my problem in different ways, so I asked different questions, and I did not get any helpful answers until now. This is my exact question; please answer this question. As I explained in the question, italic underlined alphabets are constant. Therefore D, H, and M are constant, not a function of t, Q.
Walter Roberson
Walter Roberson 2022년 4월 25일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam Chak
Sam Chak 2022년 4월 24일

0 개 추천

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

Torsten
Torsten 2022년 4월 24일
But all variables involved (Q,Tp,Irr,Te) are 1x18, not 1x1.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2022년 4월 23일

댓글:

2022년 4월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by