Documente Academic
Documente Profesional
Documente Cultură
Introduction
Engineering problems involve collection of experimental
data and make use of them in designing an engineering
system. Assume that the data set consist of
n
measurements,
D = {(xk,yk), k=1,2..n), where, x1 < x2.. < xi.. < xn.
Fitting an appropriate function or curve y = f(x) to the
data set is often very helpful. Once this is done, various
types of manipulations may be made. Some of the
important applications are in
experimental measurements,
may contain a random
component due to noise
generated in the sensor.
To obtain a good estimate of the parameters of the system,
a relatively large number of measurements are to be
made, in comparison to the degree of freedom of the
system.
In such cases, it is more appropriate to find a curve that
describes the underlying trend of the data without the
necessity of having to pass through each data point. The
type of curve, usually a polynomial, used for this purpose
shall depend upon the nature of the underlying physical
k=1,n wk.xk
k=1,n wk.x
2
k
a1
.
k=1,n wk.yk
k=1,n wk.xk.yk
a2
10
a1
.
10
30
15.15
=
a2
34.25
Polynomial Fit:
In case the underlying trend of the data is to be modeled with a
(m-1)th degree polynomial f(x), involving m coefficients, as
f(x) = a1+a2.x2+ .. +ajxj-1 ..+ amxm-1
Suppose, n> m measurements have been made to generate a set
of n data points. The method of straight line fit may be
extended to fit this polynomial to the data set with least square
error. Using weightage wk for the kth data, the weighted sumsquared error in this case may be written as
E= k=1,nwk{f(xk)-yk}2
= k=1,nwk{ a1+a2.xk2+ .. +ajxkj-1 ..+ amxkm-1-yk}2
for optimum choice of the coefficients, a 1, a2,aj, an ,
following conditions need be satisfied:
E/aj=2.k=1,nwk{a1+a2.xk2+ ..+ajxkj-1..+ amxkm-1-yk}.xjj-1} = 0 ,
=1,2,,m
wk.xk
wk.xk wk.xk2
:
a1
wk.yk
wk.xk3 wk.xk m
a2
wk.xk.yk
am
:
wk.xkm-1 .yk
b2 = wk.xk.yk = 10.00;
2.5714]
.(i)
ii)
iii)
iv)
Set
for
{
down to
do
+
}
Example: Find
for x=5
x1
x12
x13 .. x1n-1
a1
y1
x2
x22
x23 .. x2n-1
a2
y2
xn
xn2
xn3 .. xnn-1
:
an
.:
yn
1
1
1
0
1
2
0
1
4
a1
a2
a3
==
6
0
2
Solution to the above set of eqn is a1=6, a2= -10 and a3= 4
Required interpolating polynomial is f(x) = 4x2 -10x + 6
The kth Lagrange polynomial Qk, passing through the points (x1,
x2, , xn) is defined as
(x-x1). (x-x2). (x-xk-1). (x-xk+1). (x-xn)
Qk(x) =
(xk-x1). (xk-x2). (xk-xk-1). (xk-xk+1). (xk-xn)
which has the property that Qk(xj) =1 for j=k and is 0 for jk.
However, Qk(x) has non-zero values in between the data points.
This makes it very simple to write down the interpolating
polynomial through the data set D as
f(x) = k=1,n yk.Qk(x)
Example: consider the data set D={(0,6),(1,0),(2,2)}. Obtain an
interpolating polynomial of degree 2 using Lagrange
interpolating polynomial.
x2-3x+2
(x-1).(x-2)
Here, Q1(x) =
(0-1).(0-2)
(x-0).(x-2)
x2-2x
Here, Q1(x) =
(1-0).(1-2)
-1
(x-0).(x-1)
x2-x
Here, Q1(x) =
=
(2-0).(2-1)
Cubic Splines:
Different methods for polynomial interpolation are available.
Though they solve the basic interpolation problem, the result is
not always satisfactory, especially, when higher degree
polynomials are employed to fit the data set. This is illustrated
through the example given below:
Consider the simple rational function f(x) = 1/(1+x2).
The following data-set is generated from f(x) in the range -4 x
4 , in steps of 1
x
f(x)
-4
-3
0.058 0.1
-2
0.2
-1
0.5
0
1
1
0.5
2
0.2
3
4
0.1 0.058
f(x)
g(x)
(ii)
(iii)
yk = bkhk + hk2ck / 6
bk = (6yk hk2ck)/6hk
(iii)
(iv)
(vi)
means the radius of curvature for the 1 st and the last spline
functions at the terminal points x 1 and x2 have been chosen to be
infinity. This type of spline is known as a natural spline.
The system of linear equations (v) and (vi) may be recast in the
following matrix form and may be solved for c-coefficients and
hence finding the a and b coefficients.
1
0
0
h1 2(h1+h2)
h2
0
h2 2(h2+h3)
0
0
h3
0
h3
2(h3+h4)
0
0
0
0
0
0
0
0
0
0
h4
0
.
0
:
where, pk =
c1
c2
c3
c4
:
0
p2
p3
p4
.
:
cn-1
cn
pn-1
0
----(vii)
Computational Algorithm:
1. For k=1 to (n-1) compute
{
hk = (xk+1 xk) and
pk = 6 x {(yk+1-yk) /hk (yk yk-1)/hk-1}
2. Form eqn (vii) and solve for c vector [use any suitable
method for its solution]
3. for k= 1 to (n-1)
{
find ak = (6yk+1-hk2ck+1)/6hk and
bk = (6yk hk2ck)/6hk
}
4. Compute for 1 k < n
sk(x) = ak(x-xk) + bk(xk+1-x) +{(x-xk)3.ck+1 + (xk+1x)3.ck}/6hk
c1
h1 2(h1+h2) h2
c2
-18
c3
b 2= (6y2 h22c2)/6h2 = {6 x 3 (1 x
4.5)}/6 x 1 = 3.75
The required spline functions are :
s1(x) = a1(x-x1) + b1(x2-x) +{(x-x1)3.c2 + (x2-x)3.c1}/6 x 1
= 3.75(x-0) + 2(1-x) +{(x-0)3. (-4.5) + (1-x)3 . 0}/6
=3.75x + 2 2x 0.75 x3 = 2 +1.75x 0.75 x3
and similarly, s2(x) = 6.5 - 2.75x 0.75(2-x)3
++ (-
x y
0
2
4
6
8
8
0
8
48
56 96
152
-8
0
8
64
216
48
48
y 2y 3y 4y
0
2
4
6
8
8
8
0
56 48
152 96
-8
0
8
64
216
48
48
(i)
(1+ 2hD/1!+ 4h2D2 /2!+ 8h3D3 /3!+ 16h4D4 /4!+) 2.( 1+hD/1! + (hd)2/2! + (hd)3/3! + (hd)4/4! +. ) +1
= h2D2 + h3D3 + 7/12 x h4D4-
Similarly, 3 = h3D3 +3/2 x h4D4+5/4 x h5D5 +. ..and so on
b) Backward Differences:
From (ii) e-hD = 1-
Therefore, =1- e-hD
Proceeding as before,
= 1 - (1 - hD/1! + (hd)2/2! - (hd)3/3! + (hd)4/4! +. )
= hD/1! - h2d2/2 + h3d3/6 h4d4/24
2 = h2d2 - h3d3 + 7/12 x h4d4
3 = h3D3 - 3/2 x h4D4 + 5/4 x h5D5 + and so on
Derivatives in terms of dfifferences:
c) Forward Differences:
From (i) ehD = 1+
Therefore, hD = ln (1+) = - 2/2 + 3/3 -4/4 +
D = 1/h ( - 2/2 + 3/3 -4/4 + )
by
f(a+p.h) =f(a)+p.f(a)+p.(p-1)/2!.2f(a)
+p.(p-1)(p-2)/3!.3f(a) + .. (iii)
Thus a function f(x) may be expanded in an infinite series
about any of its pivotal points using above relation (iii). If
the series is truncated after n terms, the error shall be
proportional to nf(a).
Grigori-Newton backward interpolation formula:
Let f(x) be a Taylor series expandable function and its
values are known at evenly spaced values of x in the form
of data set D= {{(x1,y1), (x2,y2), ., (xn,yn)}. Let f(a) be
the value of f(x) at one of the pivotal points, say x = a.
The function f(x) at the neighbouring x = a, may be
expressed in terms of f(a) as
f(x) = f(a-p.h)
= f(a)-ph.f(a)+ p2h2/2! f(a) -p3h3/3!f(a) + ..
= ( 1 - phD + p2h2D2/2! - p3h3D3/3! + .) f(a)
= e-phDf(a)
= (e-hd)p f(a)
= (1- )p f(a) using(ii)
by
2y 3y 4y
0 -8 8
0
48 0
2 0 8
48 48 0
4 8 56 96 48 0
6 64 152 144 48
8 216 296 192
488 interpolation formula
using512
forward
10
12
1000
0
2
4
6
8
10
-8
0
8
8
8
64 56
216 152
512 296
0
48 48
96 48
144 48
0
0
so using forward
so using forward
so using forward
so using forward
+0.5.(0.5-1)(0.5-2)/3!.3f(6) +.
= 64 + 0.5 x 152 0.5 x 0.5 x 144/2+0.5 x 0.6 x1.5/6. 3f(6)
= 64 +76 18+.0625.3f(6)
= 122 + 0.0625.3f(6)
(erroneous since 3f(6) is not available)
If 3f(6)=48 were included f(7) could be corrected to 122+3=125
(v) when a= 8, 8-2.p= 7 ; therefore, p= 0.5
interpolation formula,
so using backward