%----------------------------------------------------
% To run: type draw
% To change the problem solved, simply edit the
% functions f(x,y), g(x,y)
%----------------------------------------------------
% Example: to plot the direction field for the system
%
%      x' = 4*x -   y
%      y' = 2*x + 3*y
%
%  change the following:
%
%  function xp = f(x,y)
%           xp = 4*x - y;
%
%  function yp = g(x,y)
%           yp = 2*x - 3*y
%
% then on the matlab command window type
% > draw
%----------------------------------------------------

function draw()
  axis([-2 2 -2 2])
  X1 = linspace(-2,2,21); Y1 = linspace(-2,2,21);
  figure
  hold on
  pp(@f,@g,X1,Y1,'x','y','Phase Portrait','r',0);
  hold off
  
  function xp = f(x,y)
  %m=size(x);
  % xp = zeros(m);
    xp = 2*x -y ;
  
  function yp = g(x,y)
  %m=size(x);
  % yp = ones(m);
    yp = x + y;
    
    
