Usage example for explicit_multistep employing 3-step Adams-Bashforth method
0001 % Usage example for explicit_multistep 0002 % employing 3-step Adams-Bashforth method 0003 0004 f = @(t,y) -10^2*(y - t^(-1)) - t^(-2); 0005 t0 = 1; 0006 y0 = 1; 0007 h = 0.0059; 0008 % no increase in error for h = 0.0056 0009 T = 2; 0010 rho = [0; 0; -1; 1]; 0011 sigma = [5/12; -4/3; 23/12; 0]; 0012 analytic = @(t) t.^(-1); 0013 [ y,t,err ] = explicit_multistep( f,t0,y0,h,T,rho, sigma, analytic ); 0014 figure; 0015 plot(t,y,'o'); 0016 xlabel('t'); 0017 ylabel('y(t)'); 0018 hold on; 0019 ezplot(analytic, [1 2]); 0020 legend('numerical','analytic');