% 23.04.2001, c
function [out1, out2, out3] = psi_rhs( t, x, flag, xa0, v, fnXa, fnYa )

if nargin < 3 | isempty( flag )
  % Return dy/dt = F(t,y).
  % out1 = < Insert a function of t and/or y, p1, and p2 here. >
  xa = xa0 + [eval( fnXa ); eval( fnYa ) ];
  l = norm( xa - x );
  out1 = v * (xa - x) / l;
else
  switch(flag)
   case 'init'                       % Return default [tspan,y0,options].
%    out1 = < Insert tspan here. >;
    out1 = [0 10];				     
%    out2 = < Insert y0 here. >;
    out2 = [0 0]';
%    out3 = < Insert options = odeset(...) or [] here. >;
    out3 = [];
   case 'jacobian'                   % Return matrix J(t,y) = dF/dy.
%    out1 = < Insert Jacobian matrix here. >;
   case 'jpattern'                   % Return sparsity pattern matrix S.
%    out1 = < Insert Jacobian matrix sparsity pattern here. >;
   case 'mass'                       % Return mass matrix M(t) or M.
%    out1 = < Insert mass matrix here. >;
%   case 'events'                     % Return event vector and information.
%    out1 = < Insert event function vector here. >
%    out2 = < Insert logical ISTERMINAL vector here.>;
%    out3 = < Insert DIRECTION vector here.>;
   otherwise
    error(['Unknown flag ''' flag '''.']);
  end
end
