Hadjer
Hadjer

Reputation: 31

Quiver - velocity plot Matlab

I am using Matlab quiver to plot these differential equations:

I am using this code:

[x,y] = meshgrid(0:0.2:2,0:0.2:2);
dx = x.*(1-x-y);
dy = 2*y.*(1-0.5*y-3/2*x);
figure
quiver(x,y,dx,dy)

I get this fig. I don't understand why am I getting tiny arrows even though x an y are sparse!!! I was expecting something like this

My question: Is there a way (if it is possible without using an external package) that makes the arrows larger and colored?

Thanks in advance :).

Upvotes: 2

Views: 895

Answers (1)

Hadjer
Hadjer

Reputation: 31

Thanks to Andras Deak, we came up with this solution:

[x,y] = meshgrid(0:0.2:2,0:0.2:2);
dx = x.*(1-x-y);
dy = 2*y.*(1-0.5*y-3/2*x);
% Normalization matrix
r = ( dx.^2 + dy.^2 ).^0.5;
figure
quiver(x,y,dx./r,dy./r)

Upvotes: 1

Related Questions