% plot phase portrait using quiver (arrows over phase plane): 

clear all; close all;

N=20;
L=1.5;
u=zeros(N,N);
v=zeros(N,N);
[x,y] = meshgrid(-L:L/N:L,-L:L/N:L);

for i=1:2*N+1
    for j=1:2*N+1
        % manta ray: Strogatz problem 6.6.6, page 190.
   %     u(i,j)=y(i,j)*(1-x(i,j)^2);
   %     v(i,j)=1-y(i,j)^2;
        % parrot: Strogatz problem 6.1.11, page 181.
   %     u(i,j)=y(i,j)+y(i,j)^2;
   %     v(i,j)=-x(i,j)+y(i,j)/5-x(i,j)*y(i,j)+(6/5)*y(i,j)^2;
        % Strogatz problem 6.8.5, page 193.
        u(i,j)=y(i,j)*x(i,j);
        v(i,j)=x(i,j)+y(i,j);
    end
end

quiver(x,y,u,v,2.0)

