1; y0=[1; 0]; tspan=[0 10]; f=inline('[-y(2); y(1)]', 't', 'y'); y='[cos(t); sin(t)]'; N=2; for k=1:10 %% call good disp(['N=' num2str(N) ' get w and info']) try [tt,u,info,msg]=cranknic_good(f,tspan,y0,N); t=tt(end); e_good(k)=norm(u(:,end)-eval(y)); disp(['N=' num2str(N) ' get w and info OK\n']) catch lasterr disp(['N=' num2str(N) ' get w and info Failed\n']) end %% call bad disp(['N=' num2str(N) ' get only w']) try [tt,u]=cranknic_bad(f,tspan,y0,N); t=tt(end); e_bad(k)=norm(u(:,end)-eval(y)); disp(['N=' num2str(N) ' get only w OK\n']) catch lasterr disp(['N=' num2str(N) ' get only w Failed\n']) end N=2*N; end