clear all

global gA

gA = [ 0.5 0 
        0 -2];

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


% fprintf(1, 'Select points for the initial condition. \n Press ENTER when done. \n ')
% pause


axis(2*[-5 5 -5 5].*[1 1 1 1])
grid on

[x,y] = ginput;

tend = 2;
tt = 0:0.01:tend;
xy = [];




for i = 1:length(x)
    

        [t,z] = ode45('phasepotraitode',[0 tend],[x(i) ; y(i)]);
        
        xytmp = interp1(t,z,tt);
        
        xy = [xy xytmp];

        
end

plot(x,y,'*r');
    
    for j = 1:2:size(xy,2)
        

        hold on
        plot(xy(:,j),xy(:,j+1));
        plot(xy(end,j),xy(end,j+1),'*g');        
        grid on
        axis equal

        
    end    
    