% matlab_ODE_suite_demo.m % ode45 % ode23 % ode23s % ode15s clear, home, close all y0 = 0.5; t0 = 0; tFinal = 1.05; initialDT = 0.01; errorTolerance = 0.0005; options = odeset('AbsTol',errorTolerance); [T,Y] = ode23s(@scalarStiffTestOde,[t0 tFinal],y0,options); exact = cos(T) + (y0 - 1)*exp(-100*T); norm(Y(:,1)-exact,inf) plot(T,Y(:,1),'b-o',T,exact,'r','MarkerSize',4) hold on plot(T,exact,'r') plot(T,0.45*ones(1,length(T)),'k.') hold off axis([t0-0.05 tFinal 0.4 1.05]) title 'Matlab ODE suite' disp('steps: ') length(T)