%This script, Hahn_plot, generates a phase portrait using mouse
% for the Hahn example of an equlibrium that is convergent but not stable

% Written by S. H. Zak on September 1, 2006

%t0=0;
%tf=20;
fs=14;
tspan=[0 10000];
x0=[-.1 .1]';
button=1;
% we will draw internal axes
%p=10*[-1 0;1 0];
%p=4*[-1 0;1 0];
%clf;plot(p(:,1),p(:,2),'--')
%hold on
%plot(p(:,2),p(:,1),'--')
%axis(4*[-1 1 -1 1])
axis([-1 1 -1 1])
hold on
axis square
plot([-1 1],[0 0])
plot([0 0],[-1 1])
xlabel('{\it{x}}_1','Fontsize',fs)
ylabel('{\it{x}}_2','Fontsize',fs)
set(gca,'Fontsize',fs)
grid
%axis square
    while(button==1)
       [t,x]=ode23s('Hahn_eq',tspan,x0);
      plot(x(:,1),x(:,2))
      [x1,x2,button]=ginput(1);
      x0=[x1 x2]';
    end