%Lecture35_Equations.m

function varargout=Lecture35_Equations(t,x,flag,p)

switch flag
 case ''                                 % Return dy/dt = f(t,y).
   varargout{1} = f(t,x,p);
 otherwise
   error(['Unknown flag ''' flag '''.']);
end

function dydt=f(t,x,p)

I1=p(1);
I2=p(2);
C=p(3);

f(1)=x(2)/I1;
f(2)=-x(1)/C-x(3)/C;
f(3)=x(2)/I1-x(4)/I2;
f(4)=x(3)/C;

dydt=f';