Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Experiment No: 11

Experiment Name: Study of Newton’s Forward Difference Interpolation Formulae

Objectives:
1. To study Newton’s Forward Difference Interpolation Formulae

Theory:
If a set of tabular values (xi,yi) , i.e. i=0,1,2……,n satisfy the relation y=f(x) where the explicit
nature of f(x) is not known, it is required to find a simpler function ∅(𝑥) ,such that boyj f(x) &
∅(𝑥) agree at the set of tabulated points. Such a process is called interpolation. If ∅(𝑥) is a
polynomial then the process is called polynomial interpolation

Newton invents 2 methods for interpolation:


(i) Newton’s Forward difference interpolation formula
(ii) Newton’s backward difference interpolation formula

Newton’s Forward difference interpolation formula is useful for interpolation near the beginning
of a set of tabular values which is described as,
𝑝 (𝑝−1) 𝑝 (𝑝−1)(𝑝−2) 𝑝 (𝑝−1)…….(𝑝−𝑛+1)
𝑦𝑛 (𝑥) = 𝑦0 + 𝑝∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 + ⋯ + ∆𝑛 𝑦0 …..(i)
2! 3! 𝑛!

Algorithm :

1. Start
2. Read the tabulated data of x and y in matrix form
3. Calculate values ∆𝑖 𝑦0 by conducting a loop , i.e. i=0,1,2…,n
4. Calculate values p , p (p-1) ,…. . p (p-1)… (p-n+1) by conducting another loop
5. Apply the main formula (i)
6. Solve
7. stop

1|Page
Used Commands & their functions:

Command Name Syntax Function


clc clc Clear Command Window

clear clear Remove items from workspace,


freeing up system memory
input x = input(prompt) Request user input
str = input(prompt,'s')

Matlab Script Editor Code:


clc %clear the comand window
clear %clear the memory workspace

x=input('Enter x in matrix form: ') %taking values of x


y=input('Enter x in matrix form: ') %taking values of y
s=input('Enter a middle value of x:'); %taking a middle value between given values of x

n=length(x) ;

h=x(2)-x(1);
p=(s-x(1))/h;

del(1)=y(1)
for i=1:n-1
for j=2:n
y(j-1)=y(j)-y(j-1);
end
del(i+1)=y(1); %determining various values of del^(i)y , i.e i= 0,1,2,……,n
end

term(1)=1;
m=p
q=1
for i=1:n-1
term(i+1) =m*q/factorial(i) ); %determining values of product of p
m=m*q;
q=p-i;

end

2|Page
sum=0;
for i=1:n
sum=sum+del(i)*term(i); ); %applying newton’s main formula

end

double(sum)

Matlab Command Window Ouput:

Enter the values of x:[1 3 5 7]


Enter the values of y:[24 120 336 720]
Enter a middle value of x:2

del =

24 96 120 48

ans = 60

Discussion & Conclusion:


When performed this experiment, several problems were arise . Then I had taken help from
internet, a book of writer S.S Shastri named ‘Introductory Methods of Numerical Analysis’ and
discussed with some of my friends.
During the time of coding in matlab, I had done some mistakes . i.e. writing wrong codes , syntaxes
, wrong logics. So, the output was wrong again & again . At last, checking the codes , I have done
the coding correctly.

3|Page

You might also like