Plotting orbits of 3 ODE system

조회 수: 2 (최근 30일)
pj93
pj93 2015년 2월 17일
답변: Mischa Kim 2015년 2월 20일
Hi, I'm looking to plot orbits of the following ODE system
function dx=travformula(x,t)
global a b c I gam
dx(1)=x(3);
dx(2)=(1/(c*gam))*(x(1)-a+b*x(2));
dx(3)=-gam*x(3)-c*(x(2)+x(1)-(x(1)^3)/3+I);
dx=dx'; end
Where a b c I are all given, and gam (wavespeed) will be varied on different plots.
How can I go about plotting a 3D plot of the orbit?

답변 (1개)

Mischa Kim
Mischa Kim 2015년 2월 20일
pj93, use something like
function myorbit()
x0 = [1 1 1];
tSpan = [0 10];
a = 1;
b = 1;
c = 1;
I = 1;
gam = 1;
[~,X] = ode45(@travformula,tSpan,x0,[],a,b,c,I,gam);
plot3(X(:,1),X(:,2),X(:,3))
end
function dx = travformula(~,x,a,b,c,I,gam)
dx(1) = x(3);
dx(2) = (1/(c*gam))*(x(1)-a+b*x(2));
dx(3) = -gam*x(3)-c*(x(2)+x(1)-(x(1)^3)/3+I);
dx=dx';
end
Put both functions in one file and name it myorbit.m.

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by