System of differential equations

How can I solve the system: x1'(t)=x1-x1^3+x2, x1(0)=X1_0 x2'(t)=3*x1-x2 , x2(0)=x2_0 ?

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 21 Mai 2013

0 Stimmen

Main program
y0=[0 1];
tspan=[0 10];
[t,y]=ode45(@myeq,tspan,y0)
save this function as myeq.m
function dx=myeq(t,x)
dx=zeros(2,1);
dx(1)=x(1)-x(1)^3+x(2);
dx(2)=3*x(1)-x(2) ;

Weitere Antworten (0)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Hilfe-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