% This script illustrates polynomial interpolation
clear all
clc
close all
scrnsz = get(0, 'Screensize');
f = inline('exp(sin(2*(x+5)/5))'); 
%f = inline('1./(x.^2+1)');            % the Runge example
x = linspace(-5,5,201);
fx = feval(f,x);
figure('Position', [5 10 scrnsz(3)-5 scrnsz(4)-60])
plot(x,fx,'LineWidth',2)
title(sprintf('Polynomial Interpolation: data function'));
pause
figure('Position', [5 10 scrnsz(3)-5 scrnsz(4)-60])
PolynomialInterpolation(f,5);
pause
figure('Position', [5 10 scrnsz(3)-5 scrnsz(4)-60])
PolynomialInterpolation(f,10);
pause
figure('Position', [5 10 scrnsz(3)-5 scrnsz(4)-60])
PolynomialInterpolation(f,15);
pause
figure('Position', [5 10 scrnsz(3)-5 scrnsz(4)-60])
PolynomialInterpolation(f,20);
