CS计算机代考程序代写 clear all

clear all
close all

hold on
sigma=1.0;
% Sample the function at the points below
%xpoints=[0 0.1 0.3 0.5 0.8 1.0 1.1 2 3 4 4.5 4.8 5]
xpoints=[0 0.1 0.3 0.5 0.8 1.0 1.1 2 3 5]
ypoints=1-exp(-(xpoints/sigma).^2)

n=length(xpoints)-1; %order of polynomial
b=NewtonIntCoeff(xpoints,ypoints,n);

xint=0:0.05:5;

yint=NewtonIntEval(b,xpoints,n,xint);

hold off
plot(xpoints,ypoints,’ko’,’MarkerSize’,20,’MarkerFaceColor’,’r’)
hold on
plot(xint,yint,’b-‘,’Linewidth’,4)
xlabel(‘x’)
ylabel(‘y’)

% Plot the actual function 0