Scilab Function
Last update : 18/05/2014

portrait - 2 dimensional phase portrait.

Calling Sequence

[]=portrait(f,[odem,xdim,npts,farrow,pinit])

Parameters

Description

Interactive integration and display of a 2 dimensional phase portrait of a dynamical system dx/dt=f(t,x,[u]) (where u is an optional parameter )

Examples

  
  //Interactive
  a=rand(2,2)
  deff('[ydot]=l_s(t,y)','ydot=a*y')
  portrait(l_s)

  //predator prey
  function xd=predprey(t,x)
    xd(1)=-3*x(1)+4*x(1)^2-x(1)*x(2)/2-x(1)^3;
    xd(2)=-2.1*x(2)+x(1)*x(2);
  endfunction
  bound=[-1,-1,4,4];
  nrect=12;
  x=linspace(bound(1),bound(3),nrect);
  y=linspace(bound(2),bound(4),nrect);
  x0=[];
  for i=1:size(x,'*')
   for j=1:size(y,'*')
      x0=[x0;x(i),y(j)];
   end
  end
  portrait(predprey,"default",[-1,-1,4,4],[3000,0.01],'f',x0');
  
  

See Also

ode,