การประมาณค่าในช่วงและนอกช่วง

You might also like

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

(interpolation)

(extrapolation)

4.2

(A Development of MATLAB Program for Numerical Methods)


(Newtons divided-difference interpolation
polynomial)


f(x)

4.2.1

f(x) (linear
interpolation) 2
X0 X1

J0 X
2
2

(A Development of MATLAB Program for Numerical Methods)

X0 = 2.0 X1 = 4.0

2 J0(2.0) = 0.2239
J0(4.0) = -0.3971

4.1


f(X0 = 2.0) = 0.2239 f(X1 = 4.0) =
-0.3971 4.2

X=3.2


4.1

(A Development of MATLAB Program for Numerical Methods)

(4.3)
X=3.2

f( x=3.2 ) = 0.2239 + (3.2 2.0) (-0.39710.2239)/(4.0-2.0)
= 0.2239 - 0.3726
f(3.2) = -0.1487
(4.4)
-0.3202
4.1
= ( -0.3202 + 0.1487 ) / ( -0.3202 ) *100% =
53.56%

(4.5)

4.2.2

f(x)
(quadratic interpolation)

(A Development of MATLAB Program for Numerical Methods)

3 X0, X1 X2


x X0 ,X2
3 f( x0 =
2.0 ) = 0.2239 , f( x1=3.0 ) = -0.2601 f( x2 =
4.0 ) = -0.3971
f(x)





(quadratic interpolation)

f(x) = C0 +C1 (x-x0) +C2 (x-x0)(x-x1)


(4.6)
C0 ,C1 C2
x0 , x1
x2

(A Development of MATLAB Program for Numerical Methods)

x = x0 :

f(x0) = C0 + 0 + 0 = C0
(4.7a)

x = x1 :

f(x1) = C0 + C1( x1-x0 )


= f(x0) + C1( x1-x0 )
C1

= (f(x1) f(x0)) / x1-x0

(4.7b)
x = x2 :

f(x2) = C0 + C1( x2-x0 ) + C2( x2-x0 ) (

x2-x1 )
C2

= [ (f(x2) f(x1)) / (x2-x1) ] [ (f(x1)

f(x0)) / (x1-x0) ]
/ ( x2-x0 )
(4.7c)
C0 , C1 C2
(4.6)

4.3

(A Development of MATLAB Program for Numerical Methods)

4.5
x=3.2 4.1
x=3.2

x=3.2
4.6
4.1
x=3.2 10
x=3.2 -0.3201
-0.3201
= [( -0.3201 + 0.3201 ) / -0.3201] *100%
= 0.03%

(4.16)


4.2

(A Development of MATLAB Program for Numerical Methods)

4.1 1.53% 53.56%

4.3

( Lagrange interpolation polynomials )








4.3.1

(A Development of MATLAB Program for Numerical Methods)

2

f(x) = ax = b
(4.17)
a b
x0 x1

x = x0 : f(x0) = ax0 + b
(4.18a)

x = x1 : f(x1) = ax1 + b
(4.18b)

f(x) = [ (x1-x) / (x1-x0) ] f(x0) + [ (x0-x) / (x0x1) ] f(x0)(4.19)

(4.19)

f(x) = L0 (x) f (x0) + L1 (x) f(x1)


(4.20)
L0(x) = (x1-x) / (x1-x0) L1(x) = (x0-x) / (x0x1)

(4.21)

(A Development of MATLAB Program for Numerical Methods)

L0(x) L1(x)
(Lagrange interpolation
polynomials)

(A Development of MATLAB Program for Numerical Methods)

You might also like