The aim of this lab is to write a function to compute the co
The aim of this lab is to write a function to compute the coefficients for a Hermite polynomial interpolating function using divided differences and then to use the coefficients to compute the Hermite interpolating polynomial. The algorithm for the divided difference formulas for the Hermite polynomial coefficients is: OUTPUT e, the appropriate divided differences, where the Hermite interpolating polymomial is Hren (x)- STEP 1 For i 0,1 ....n f(x) f(x) f (x) If i then End If End STEP 2 For i-2,3, ...,2n+1 For j- 2,3,..., i End End STEP 3. OUTPUT STOP
Solution
opts = odeset(\'Stats\',\'on\');
tspan = [0 2];
y0 = 1;
lambda = 1e3;
subplot(1,2,1)
disp(\'ode45 stats:\')
tic, ode45(@(t,y) -lambda*y, tspan, y0, opts), toc
title(\'ode45\')
subplot(1,2,2)
disp(\' \')
disp(\'ode23 stats:\')
tic, ode23(@(t,y) -lambda*y, tspan, y0, opts), toc
title(\'ode23\')
