You can define two m files to run the simulation of the differential equations. One m file defines the equations, the other does the simulation. To simulate a system of two variables with differential equations: x1' = (1 - 0.01*x2)*x1 x2' = (-1 + 0.02*x1)*x2 We write one m file that defines the equations: (which must be called inel.m in this example) ************************************************ function xp = inel(t,x); % Solves differential equations % March 5, 1998 xp(1) = (1 - .01*x(2))*x(1); xp(2) = (-1 + .02*x(1))*x(2); ************************************************ and another m file that runs the simulation: ************************************************ % Define the starting and ending times, and the % initial conditions. t0=0; tfinal=10; x0=[10 0]'; [t,x]=ode45('inel',t0,tfinal,x0); ************************************************