Using ODE45 to solve Rossler equations
조회 수: 10 (최근 30일)
이전 댓글 표시
The Rossler equations are defined as
x'(t)=-x(t)-y(t)
y'(t)=ax(t)+y(t)
z'(t)=b+z(t)(x(t)-c)
and I am trying to use ode45 to solve them
I have so far created a ross function file
function dx = ross(t,x)
%ross: Computes the derivatives involved in solving the
%ross equations.
a=-0.1;
b=2;
c=5.7;
%Right hand sides
dx=zeros(3,1);
dx(1)=-1*x(1)-1*x(2);
dx(2)=a*x(1)+x(2);
dx(3)=b+(x(3)*(x(1)-c));
and I am trying the below code but it doesnt stop running and seems to be stuck in a loop
clear all
x0=[-8 8 27];
tspan=[0,20];
[t,x]=ode45(@ross,tspan,x0)
%or run
[t,x]=ode45(@lorenz,tspan,x0)
%BUT NOT BOTH IN THE SAME CODE (1 OR THE OTHER LORENZ OR ROSS)
plot3(x(:,1),x(:,2),x(:,3),'b','linewidth',1.5)
however if I have instead of @ross but have @lorenz
[t,x]=ode45(@lorenz,tspan,x0)
and try
function dx = lorenz(t,x)
% Parameters
sigma=10;
beta=8/3;
rho=28;
% Differential Equations
dx=zeros(3,1);
dx(1)=sigma*(x(2)-x(1));
dx(2)=rho*x(1)-x(2)-x(1)*x(3);
dx(3)=x(1)*x(2)-beta*x(3);
it seems to work fine, my question is where am I going wrong with my ross equations
답변 (2개)
Tanggo Tang
2021년 3월 29일
Hi you have err in ross attraction
function dx = ross(t,x)
a = 0.2;
b = 0.2;
c = 5.7 ;
dx=zeros(3,1);
dx(1)=-x(2)-x(3); %here
dx(2)=x(1)+a*x(2); %and here
dx(3)=b+(x(3)*(x(1)-c));
end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!