How to plot nullclines with differential equations
Ältere Kommentare anzeigen
Im trying to plot nullclines on top of a mesh grid then use ode 45
i cant seem to get the nullclines on their though after googling for hours. This is my code:
x1min = -1; x1max = 6; x2min = -1; x2max = 6;
x1step = 0.3; x2step = 0.3;
[x1, x2] = meshgrid(x1min:x1step:x1max, x2min:x2step:x2max);
a = 1.5;
b=1.1;
g=2.5;
d=1.4;
dx1 = -a*x1+b*x1*x2;
dx2 = g*x2-d*x1*x2;
nullX1= -a + b.*x2;
nullX2= g - d.*x1;
quiver(x1, x2, dx1,dx2,'AutoScaleFactor',0.5)
axis([x1min x1max x2min x2max])
xlabel('$x1$','Interpreter','latex')
ylabel('$x2$','Interpreter','latex')
title('Vector field example','Interpreter','latex')
x=0:0.5:30;
plot(x,nullX1,'r-')
hold on
plot(x,nullX2,'k-')
hold on
*****It keeps telling my my vectors must be the same length, so not sure if im using the wrong parameters.
Thanks!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

