Solving System differential equation

2 Ansichten (letzte 30 Tage)
MoHizzel
MoHizzel am 13 Apr. 2015
Kommentiert: Torsten am 14 Apr. 2015
Hi, I am new to matlab. I have a very simple question. How can I solve the following differential equation dx/dt = [1,2;3,4]*[x1;x2]+[0;1]?
Thank you very much.
  2 Kommentare
MoHizzel
MoHizzel am 13 Apr. 2015
How can I modify this so the answer is a general equation of x in terms of t? So something like x(t)=5e^t[1;1]
Torsten
Torsten am 14 Apr. 2015
help dsolve
Best wishes
Torsten.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sadra
Sadra am 13 Apr. 2015
Bearbeitet: Sadra am 13 Apr. 2015
you could solve it with ODE45
your function is:
function dy = my_ODE(t,y)
dy=zeros(2,1);
dy=[1 2;3 4]*[y(1);y(2)]+[0;1];
end
and you should solve it with ODE45 with this script :
Time=2; %2seconds
InitialValues=[0;0];
[t,y]=ode45(@my_ODE,[0 Time],InitialValues)
plot(t,y(1),'-',t,y(2),'-.')
legend('y(1)','y(2)')
  3 Kommentare
Star Strider
Star Strider am 13 Apr. 2015
Also see the documentation for the matrix exponential, expm.
Sadra
Sadra am 14 Apr. 2015
you should write your equations in state space ( Y_dot=f(x,t) ) form.
for extra details and exapmle see the documaentation for ODE

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by