clear all ; close all ; clc ;

f = @(t, Y) [Y(2) ; Y(1) ];

y1 = linspace(-2, 2, 20) ;
y2 = linspace(-2, 2, 20) ;
[x,y]=meshgrid(y1,y2);
u = zeros(size(x)) ;
v = zeros(size(y)) ;
t = 0 ;
for i = 1:numel(x)
    Yprime = f(t,[x(i) ; y(i)]);
    u(i) = Yprime(1) ;
    v(i) = Yprime(2) ;
end
hold on;

quiver(x,y ,u ,v , 'r') ; figure(gcf)
xlabel('y_1') ;
ylabel('y_2');
axis tight equal ;

