%%
function [out1, out2, out3]=centereq(t,X,flag,param)
%
a=param(1);
b=param(2);

x=X(1);y=X(2);

if nargin < 3 || isempty(flag)
out1 = [a*x^2;
        -b*y];
else
   switch(flag)
   case 'init'
     out1 = [0; 1];
     out2 = [0 0 ];
     out3 = []; %odeset('Vectorized', 1);
     case 'events' 
     %sec1 = z+1/eps/1.000000002; 
     sec1 = -y; 
     out1 = [sec1];
     out2 = [0];
     out3 = [1];
   otherwise
      error(['Unknown flag ''' flag ''.']);
   end

end