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 ?

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 21 Mai 2013

0 votes

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) ;

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by