Home > K25104 > ODEs > explicit_multistep_script_2.m

explicit_multistep_script_2

PURPOSE ^

Usage example for explicit_multistep

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Usage example for explicit_multistep
 employing 3-step Adams-Bashforth method

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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');

Generated on Mon 18-Jan-2016 10:25:49 by m2html © 2005