clear all

global gA

gA = [ 0.5 0 
        0 -2];

gA = [ -1 1 
        0 -1];    
%     
% gA = [-1  10 
%     -10 -1];

x = .5:0.1:1;
y = x;
[xx,yy] = meshgrid(x);
tend = 1;
tt = 0:0.01:tend;
xy = [];

for i = 1:length(x)
    
    for j = 1:length(x)

        [t,z] = ode45('arnoldcatode',[0 tend],[x(i) ; y(j)]);
        
        xytmp = interp1(t,z,tt);
        
        xy = [xy xytmp];
        
    end
        
end
for i = 1:5:length(tt)
    
    clf
    
    for j = 1:2:size(xy,2)
        
        plot(xx,yy,'.r');
        hold on
        plot(xy(i,j),xy(i,j+1),'.');
        axis(0.5*[-5 5 -5 5].*[0 1 0 1])
        grid on
        
    end
    pause(0.05)
    
end