function out = ex3ode(t,y,flag)

% Copyright 1999, The MathWorks, Inc.

if nargin < 3 | isempty(flag)
  out = [  y(3)
            y(4)
          - y(1) * y(5)
          - y(2) * y(5) - 1
            y(3)^2 + y(4)^2 - y(2) - y(5) ];
else
  switch(flag)           
  case 'mass'
    out = diag([1 1 1 1 0]);
  otherwise
    error(['Unknown flag ''' flag '''.']);
  end
end
            