Parseval
Parseval

Reputation: 833

Quiver plot does not agree with trajectories

So I have this plot:

enter image description here

It's essentially a system of nonlinear ODE's describing two competing species (predator/prey) and I want to visualise the trajectories but I feel like the arrows in my quiverplot don't really match the trajectory lines (dashed red line), particularly around the lower left area.

Have I made a mistake somewhere? It should look something like this:

enter image description here

Upvotes: 1

Views: 178

Answers (1)

fleico
fleico

Reputation: 146

You need to vectorize the multiplication operators in the ODE by adding dots

dX1 = r1*X1.*(1-X1/K1)-alpha1*X1.*X2;
dX2 = r2*X2.*(1-X2/K2)-alpha2*X2.*X1;

Also, you might want to consider making your vector field a bit more refined, maybe linspace(0,15,20) so you can visualize it better.

Upvotes: 1

Related Questions