Interpolation and Curve Fitting
Interpolation and Curve Fitting
4.1 Interpolation
Second Differences
> are the differences of the first differences
> are denoted by A%y, A%y, . ..., A%V
O2=3) =527 0
2a=)- G- =) === -
Ay =yy=3p2=3 2=y ete.
Example:
x [1]2[3]a]s
y=f)
[+ 6]9[12[17
y | Ay Ay Ay Ay
w N =] x
Alw|no|—|o|m~.
42 1 1 3
6|3 0 2
vl
3 2
©
b) Backward Differences
> denoted by V
» defined as: Vf(x) = f(x) — f(x— h)
> can be written as:
Vyi=y— ypi=nn-1..,1
> orVy1=y1—= ¥0,V¥2=Y2= Y15+
s V¥n= ¥n— Yn1
» Second Differences:
ey = Vely = Tl i=nn-1, ..k
V=3,V =V
Example:
x _ [1]2(3]41]5s
y=fix) [4]6[9]1
[N
3
i x y |V Vy Vy VY
01 4
1 2 6| 2
23 913 1
3 4 1230 A
4 5 17|65
2 2 3
©) Central Differences
> denoted by the symbol §
> defined by: 8f{x) = f(x + h/2) - f{x - h/2)
where h is the interval of differencing
> First central differences:
»12=y1-y0.
W32=y2=Y1 s
Wn-1/2=In=Vn-1-
> Second central differences:
&y = 85ty -
Example:
X 213|415
y=f(x) [4]6[9][12]17
® Shift operator: E
= Differential operator: D
= Average operator: p
Shift operator, E
= defined as: Eftx)=fx = k)
=or Eyi=Ji
= shifts the function value y, to the next higher value y;.,
= Second order shift operator:
=Ef(x) = E[Ef (x)] = E[ftx + I)] = fix + 2h)
=EY (x)= (x+ nh) or B, =yimy
= Inverse shift operator (E=):
=Ex)=fIx - h)
»EY(x)=f(x-2h) and E%(x)=f(x—nh)
= EYfx)=£(x +th) where r can be positive/negative
Average operator, |1
= defined as:
Wy =—;b‘l.x 2¥¥2)
Differential operator, D
=defined as:
D =)= 7'
D) 1)
= In operator notation:
Eftx) = [I +hD= D)y *] 10
where the series in brackets is the expression for the
exponential
=-E= gD
= From the definition of A:
V)= + 1) - fx)
= Using the operatorE:
VW) = Efx) - /1)
A= (E-1) fix)
= which can be expressed as an identity:
A=E-1
ie E=1+2
Solution:
Johy = Efix) = (A+1)1x)
Jo=hy = M) +Ax)
Dividing both sides by fix):
A
Alog fl)=log
™ ™ |1+ 'V-“v)]
,_.
Ky E-1 A a=vri-1
v T-E' 1-(1-a7" v
A=At v -t
{r=gafoent | {1i-gaji-n
( 1 + ey
& p=f{x) such thatyo, y1, 3, ...,ya denote the corresponding values of the function
4 1f one or more values of y = f (x) are missing, we can determine the missing values by
employing the relationship between the operators E and A
4 Suppose
yo, Y1, V2, «eesIn
- denote the values of y = f (x)
4 Let one of the values ofy is missing since n values of the functions are known
4 In equation: 4"yo =0
4 or using the shift operator, E:
(E-1)"po=0
4 Expanding (E—1)"yo=0
[E" = nCiE*! + nCE2 + ..+ (-1)"] yo=0
-1
Eryy - nE*lyy = "“:' ) By = e = (1) =0
n(n=1)
Y= My ™ Yz 1)y =0
or 2
4 which is quite useful in determining the missing values without actually constructing
the difference table
Example 1:
Example 2:
Page 7 of 18
Compiled by: Redin Jhon T. Carriedo, ECE
Example 3:
2§5,,9 Y= = 57 Deq.(2)
=
4 used to interpolate the values of y near the beginning of a set of equally spaced tabular
values
1 i(u=1) 2 w(ue=1)(u=2) 1
0(x)= yy+ udyg+ ——A) * Tl Ay Fee
" u(u-l)-«(u—(n—l))An"h
n!
Example 1:
Given: X y dy ay
Xo= 15500 15500 124.439 00402 -0.0001
=10 15510 124.5392 0.0401 0
¥ =15516 15520 124.5793 0.0401
15530 124.6194
Solution: Using Newton’s forward IPF:
W= =N ()= g +udrg + ”“’”“” A%yg 4o
u=16/10 &
(=16 J1x) = 124.4990 + 1.6(0.0402) + 0.48(-0.0001)
= 1.
/(15516) = 124.563272 |
Example 2:
The values of sin x are given below for different values of x. Find the value of sin 42°.
Solution:
u=(42-40)/5=0.4
S 428 + 0.4(0.0643)+ (-0.12)(-0.0054) +(0.064)(-0.0004)
| f(42°) 6913
Problem:
4 used for interpolating values of y near the end of the tabulated values
[ Ijvn”
ot =g, + vV + S G vy n! )
X -X,
where: v =
h
4 also used for extrapolating values of y a litlle backward of yn
Example 1:
Calculate the value of f (84) for the data given in the table.
X 4] 50 60| 70] 80 90
fix) | 204 | 224 | 246 296 | 324
o
3
S
Since 84 is near the end of
table, we will use Newton's
backward IPF:
Solution:
J)=y, + Wy, s —
»,=324,x,=90,=84.h =10
Using backward difference: v=(-x,)h=-0.6
x| vy [vy|vy|vy 184)=324 +(-0.6)(28) +(-0.12)(2)
40 | 204 f184)=324-16.8-0.24
50 | 224 | 20 ]
60| 246 | 22 | 2 f184) = 306.96
70|20 [24] 2 | 0 )
80| 206 (26| 2 | ©
90324 [28] 2 [ 0
Example 2:
From the following table, estimate the no. of students who obtained marks in computer
programming between 75 and 80.
Marks 35-45 45-55 | 55-65 6575 75-83
No. of students 20 40 60 60 20
Problem:
X
where: y =
Example:
Using Newton’s forward interpolation formula find the value of cos 52°from the following data
and estimate the error.
x y Ay Ay Ay
45°] 0.7071] -0.0643| -0.0049| 0.0005
50°| 0.6428| -0.0692| -0.0044
55°| 0.5736] -0.0736
60° 0.5
Solution: Computing for Error:
u=(52-45/5=14 (=N =2
Using NFI Formula: R(52) = -‘——.,—‘-)‘ Ay
f(52) = 0.7077+1.4(-0.0643)
+0.28(-0.0049) =1.4(0.4)(-0.6)(0.0005)/6
+ (-0.056)(0.0005) R(52) = -0.000028
f(52) = 0.615680
S=x,) ay(x-
Ax) = agv=vy)=
(¥) F
e p) a,,(\'—\q](r— Xy Ng1)
XX=x
= Substituting the values of dq, @,
oo (x=x)(x =2
y=/r(x)= o ormx flxg)+
(X=X )x = X,)
fx)+-
(3 = X))(% = x)
(X=X )X =X;)(x fix)
O S 1. ) Ll T 1
(%, =X)(X,, = )X, = X,0p)
Example 1:
Example 2:
x = 10 from the
Using Lagrange’s interpolation formula, find the value of y corresponding to
following data
x | s[ 6| o] 1}
Solution: y=1{x) [ 380 [-2 [ 196 | 508
(- n)(x =) o+ (X =xp)(x = %3 )(X = %3)
PO G Tt ) %) O )y ~
(x=x)x=n)x=x) o (x=x,)(x=
(6 =%)a =) =%)" (=) =x)(%=x;) .
th X 3
110)=(10 - 6)(10 - 8)(10- 11)*(380/-24) + (10 5)(10 - 9)(10 - 11)*(-2/15)
+(10-5)(10 - 6)(10 - 11)*(1961-24) + (10 - 5)(10 - 6)(10 - 9)*(508/60)
= @)(1)(-1)*(95/-6) + (5)(N)(-1)*(-2/15)
+ (5)(4)(-1)"(49/-6) +(5)(4)(1)*(127/15)
= -380/-6 + 10/15 + (-980/-6) + 2540/15
= 63.333+0.667+163.333 + 169.333
£(10) = 396.667
C(x=xg = %)X
)(x = X,p)
* (3, =% )%, = %))+ (%, = %pu1) Ya
a function of y:
4 By interchanging x and y, x can be expressed as
Example:
value
certain values of x. Find the
values of y corresponding to
The following table gives the
of x wheny=297. [ [2] s| 7
x
v=fx) (1] 12117317
e
Yoy . =3
b Jr) Yot (8} = ),“” ) (=) Xy e
_ y2
(y=yr==)
x = ¥a)
(o =31)(Fo=¥2)=(¥o 01 =30)0n =20 = e
. (= 3 = dan)
=)
T Yol =2
= 1 = Vet
(1-117)(1-317)]
x= [(297—12)(20 17)(297-317)1*(\) J1(1-12)
97-1
17)]
+[@97-1)OT-11DIT-3II D) [(12-1)(12-117)(12-3 7)]
(931 [(1 17-1 )(11 7-12 )(11 7-31
+ [(297-1)(297-12)(297-
+[(207-1)@IT-1E IT- UDI )/ [B17-DEIT-1G17-117)]
¥ =-1026000)(1)/-403216 +-1065600(2)/352275
+ -1687200(5)/-2436000 + 15184800(7)/19276000
472
x y | &
Xo—3h Ars
xo-2h
x0Tt
X
No+ht
Xot2h
ot 3h
Lt - 1)(,;-3)[.\‘,
41
Example:
Apply Bessel’s interpolation formula to obtain yas, given that yzo = 2860, yz = 3167,
yuw=3555andys2=4112.
T T TA e il y=25.x=24
LI ) |
1| 20 [ 2860 [307 [ 81 | 88 ;
0| 24 | 3167 [ 388 [ 169 L=
1| 28 | 3555 | 557 = (x=xo)/h
2| 32 | 4112 =1/4=0.25
_ylady, +ain ] ~ =05
_\-:,l'u-ruA,ru+"("2 ”lA Bl "; b 1-"‘“ )é“ )A3.|'.x
Example 13
Apply Stirling’s interpolation formula to obtain yzs, given that y20 = 2860, ya4 = 3167,
and ysz5=
yas =355 4112.
Given: oH 1) ¥ | Ay Ay | Ay
Example 2:
Apply Stirling’s interpolation formula to obtain yzs, given that yzo = 48234, yis = 47354,
y30=46267, y35=44978 and y0 = 43389.
2 2 2 22 a2
e =17) s u(ut =17 )t =2%)
+[u,1¢,+ 3 ATy, + 5 Aty
where:
y=
Compiled
piled by:by: Redin
Redin Jhon
T. Carriedo,
R ECE Page
17 of 18
Example:
Apply Everett’s interpolation formula to obtain yzs, given that yzo = 2860, y2¢
= 3167,
y28=3555and y32=4112.
Exercise no. 4: