How do I plot the phase space for a system of 3 ODEs

25 views (last 30 days)
Jackson Seith
Jackson Seith on 19 Apr 2020
Edited: Ameer Hamza on 21 Apr 2020
I am new to matlab and need to plot a phase space for a system of three ODEs. My ODEs are Udot = aU(1-U/Q) - bUS, Sdot = -cS + dSU - jSO, and Odot = -kO + lOS. I have values for the parameters: a=180, b=60, c=120, d=30, j=120, k=30, l=15, Q=60, and want to plot the 3D phase space of this system of ODEs. Thank You.

Answers (1)

Ameer Hamza
Ameer Hamza on 19 Apr 2020
Edited: Ameer Hamza on 21 Apr 2020
try this
a=180;
b=60;
c=120;
d=30;
j=120;
k=30;
l=15;
Q=60;
% Udot = aU(1-U/Q) - bUS
% Sdot = -cS + dSU - jSO
% Odot = -kO + lOS
dudt = @(u,s,o) a.*u.*(1-u/Q) - b.*u.*s;
dsdt = @(u,s,o) -c.*s + d.*s.*u - j.*s.*o;
dodt = @(u,s,o) -k.*o + l.*o.*s;
u = 0:0.1:1;
s = 0:2:20;
o = 0:3:30;
[U,S,O] = meshgrid(u,s,o);
dU = dudt(U,S,O);
dS = dsdt(U,S,O);
dO = dodt(U,S,O);
quiver3(U,S,O,dU,dS,dO);
axis tight

Community Treasure Hunt

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

Start Hunting!