Home > K25104 > Interpolation > Newton_Horner_script.m

Newton_Horner_script

PURPOSE ^

Usage example for Newton_Horner

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Usage example for Newton_Horner
 related to Figure 3.1

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Usage example for Newton_Horner
0002 % related to Figure 3.1
0003 
0004 x = (-1:0.01:1)';
0005 [~,xn] = size(x);
0006 y = ones(xn)./(ones(xn)+25*x.^2);
0007 plot(x,y,'k')  % plot Runge's example
0008 hold
0009 n = 8;
0010 inter = 2/n;
0011 nodes = (-1:inter:1)';
0012 values = ones(n+1,1)./(ones(n+1,1)+25*nodes.^2);
0013 [y] = Newton_Horner(nodes, values, x );
0014 plot(x,y)  % plot the interpolant
0015 plot(nodes, values,'o')    % plot the data

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