Professional Documents
Culture Documents
Newton Interpolation
Newton Interpolation
Newton Interpolation
Group: A+B
Scilab Code 11
Aim:
To find the population of the town in year
1895 using Newton’s Interpolation Method.
clc
clear
x = [1891;1901;1911;1921;1931]
y = [46;66;81;93;101]
n = length(x)
for j=2:n
for i = 1:(n-j+1)
y(i,j)=y(i+1,j-1)-y(i,j-1)
end
end
k = [x y]
disp("Year(x) Pop(y) d1y d2y d3y d4y")
disp(k)
z = 1895
h = x(2)-x(1)
//disp(h)
p =(z-x(1))/h
//disp(p)
t = y(1)
r=1
for j = 1:n-1
r = (r*(p-(j-1)))
t = (t + ((r*y(1,j+1))/factorial(j)))
end
disp("Population of the town in year 1895 is "+string(t))
OUTPUT: