Hello, I am trying to solve the ode for four dimensional system have tried ODE23 and ODE45. The code is running till t 1.8s only. Couldn't find a reason.

2 views (last 30 days)
This is the main code:
clc;
close all;clear all;
T=0:.001:2;
x0=[1,1,0,1];
[t,x]=ode23(@newchao,T,x0);
x1=x(:,1);
x2=x(:,2);
x3=x(:,3);
x4=x(:,4);
figure;
plot3(x1,x2,x3);
xlabel('x1');
ylabel('x2');
zlabel('x3');
grid on;
figure(2);
plot3(x2,x3,x4);
xlabel('x2');
ylabel('x3');
zlabel('x4');
grid on;
figure(3);
plot3(x3,x4,x1);
xlabel('x3');
ylabel('x4');
zlabel('x1');
grid on;
figure(4);
plot3(x1,x2,x4);
xlabel('x1');
ylabel('x2');
zlabel('x4');
grid on;
This is the four dimensional system's function:
function dx=newchao(T,x)
a=-35;
b=10;
c=-1;
d=-10;
b1=1;
b2=-1;
b3=1;
b4=1;
dx=zeros(4,1);
dx(1)=a*x(1)-b1*x(1)*x(2)*x(3);
dx(2)=b*x(2)-b2*x(1)*x(3)*x(4);
dx(3)=c*x(3)-b3*x(1)*x(2)*x(4);
dx(4)=d*x(4)-b4*x(1)*x(2)*x(3);
end

Answers (0)

Categories

Find more on Programming 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!