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 ?

 Accepted Answer

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

More Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!