%PHP_8_9O.M script produces a phase portrait interactively using the mouse

% Last modified by S. H. Zak on November 19, 2002

clear
clc
disp('You will utilize the mouse to generate a phase portrait of equation (8.5).')
disp('               -----------------------------------------------------------------------------------------')
disp('After reading the next three lines press ENTER to continue.')
disp('You can maximize the figure for the better effect.')
disp('To generate a trajectory, use the mouse to select the initial condition and click on the LEFT BUTTON.')
disp('Press the RIGHT BUTTON to quit.')
pause
tspan=[0 10];
x0=[-2 -2]';
button=1;
axis([-4 4 -10 10])
hold on
grid
% we now draw internal axes
%plot([-4 4],[0 0])
%plot([0 0],[-10 10])
%grid
xlabel('{\it{x}}_1','Fontsize',14)
ylabel('{\it{x}}_2','Fontsize',14)
title('Phase portrait of (8.5) for {\it u}=0','Fontsize',14)
set(gca,'Fontsize',14)
    while(button==1)
       [t,x]=ode23s(@tst4f7,tspan,x0);
      plot(x(:,1),x(:,2))
      [x1,x2,button]=ginput(1);
      x0=[x1 x2]';
    end