>> small;
where small.m contains:
t0=0;
tfinal=10;
yin=1;
tstep=0.2;
tspan=t0:tstep:tfinal;
[t,yode]=ode45('small_rhs',tspan,yin); % variable step RK4/5
plot(t,yode)
(This routine outputs the solution at t0,t0+tstep, ..., tfinal but calculates the solution at whatever variable step-size is required.)
function rhs=small_rhs(t,y) rhs=t;
note that the FILENAME, not the function name, is used in the call to ode45.m
texact=0:1:10; solution=0.5*texact.^2 + 1; plot(texact,solution,'g+',t,yode,'r')