Title: CPE 332 Computer Engineering Mathematics II
1CPE 332Computer Engineering Mathematics II
2Curve Fitting
- ?????????? ???????????????????????????
??????????????????? ????????????????? Function
?????????????????????????????????????? - Function ????????????????? Polynomial ??? Degree
????? - Function ???????????????????????? Cosine Function
- ???????????????? ?????????????????? Function
?????????????????????????? ????????????
Interpolation
3Interpolation
y
x
4Linear Interpolation
y
x
5Second Degree Piecewise Interpolation
y
x
6Third Degree Piecewise Interpolation
y
x
7Higher Order Degree
- ?????????? ?????????????? Oscillate ???
- Function ???????????? Polynomial ??????????????
- N Degree ????? N1 ????????????????? Function
8Spline Interpolation
- ?????????? Polynomial Degree ???? ??????????
Third Degree ???? Cube - ????? Cubic Spline
- Cubic Spline ???? Polynomial ??????? 2 ???(??????
4) ?????????????????????????????? Polynomial
??????????????? ??????????? Polynomial
??????????? First Derivative ??? Second
Derivative ??????? - 2 ?????? 2 ????? ???????????????????? First ???
Second Derivative ???? 4 ????? 4 Unknown - ????????????????????? First Derivative
??????????????? ????????? Second Derivative
???????????? ??????? ???????? Natural Spline - ??????????????????????
9Spline Interpolation
y
x
10???????? Cubic Spline Interpolation (1)
- ????????????????????????
- ????????????? Curve ??????????????? ?????? Third
Degree Polynomial - ?? 4 Unknown ????????? ???????????????? 4 ?????
?????? 4 ?????? Data ???????? - ????? 3rd Degree Polynomial ????????????? 4 ???
????????????????????? 4 ??? ??????????????
?????????????? 4 ???????? Polynomial ?????????? - Polynomial ?????????????????????????????????
11???????? Cubic Spline Interpolation (2)
- Example ????? Data 7 ?????????
- Yi 2 0 3 4 5 3 1 Xi 0 1 2 3 4 5 6
- ??????? Third Degree Polynomial ????? Fit Data
????????
12???????? Cubic Spline Interpolation (3)
y1
y0
?????????? Cubic Polynomial 2 ?????? Fit 4 ??????
?????? 2 Fit 4 ???????? ????????? 4 ???????????
13Cubic Spline Int.(4)
- Polynomial ?????? ??????????????
- ???????????
14Cubic Spline Int.(5)
- Polynomial ????????? ??????????????
- ???????????
15Cubic Spline Int.(6)
16Cubic Spline Int.(7)
17Cubic Spline Int.(8)
18Cubic Spline Int.(9)
- ???????????????????????????????????????
- ????????????????? First Derivative ??????????
Polynomial ?????? ?????????? First Derivative
???????????? Polynomial ?????? 2 - ??????????? ??????????????? First Derivative
???????????????? Polynomial ???????????
???????????? - ???????????????????? 4 ????? ??????? 4
Coefficient ????????????????? Function ?????????
????????? First Derivative ????????????? (4 ???
???) - ???????? ???????????? Data (?????????????)
?????????? Third Degree Polynomial ????????
19Cubic Spline Int.(10)
- ?????????? Data n ?????? xii1,..,n ??? yi
i1,..,n ???????????? Cubic Polynomial, Si(x)
??????? n-1 function ?????????? Interpolate
????????????? ?????????????????????????????
20Cubic Spline Int.(11)
- ????? Polynomial ??????????????????????? Variable
????????? (Delay) ??????????? xi
??????????????????? ????? - ??? First ??? Second Derivative ????????
Polynomial ???????????????????
21Cubic Spline Int.(12)
- ?????? xi ????????????????????? Polynomial
???????? - ????????? xi ?????????????? Function ???
- ????????? ??????(?????????????????????????????????
???????????????)
22Cubic Spline Int.(13)
- ???????????????????????? First Derivative
??????????????????? - ??????? ??????
- ????????????? ??? Second Derivative
??????????????????????????
23Cubic Spline Int.(14)
- ??????
- ???????
- ???
- ???
- ??????
24Cubic Spline Int.(15)
- ??????????????????? ????????
- ???????
- ????????????????????
- ???? ai ??? ci ??????????????????????
25Cubic Spline Int.(16)
- ???????????????????????????
- ?????????????????? Matrix ??????
26Cubic Spline Int.(17)
- ???
- ???????????????????? Matrix ?????????
27Cubic Spline Int.(18)
-
- ???????????????? n-2 ???????? n unknown
???????????????????? ??? Condition
??????????????????????????? - ??? Condition ????????????????????? ?????????
Variation ??? Cubic Spline Interpolation ????????
28Cubic Spline Int.(19)
- ?????????????????? Spline ?????? ??? ???
Condition ????????????????? - Natural Spline
- ??????????? M1Mn0
- Parabolic Runout Spline
- ??????????? M1M2 ??? MnMn-1
- Cubic Runout Spline
- ????????? M12M2-M3 ??? Mn2Mn-1-Mn-2
- ?????????????????????????????? Natural Spline
29Cubic Spline Int.(20)
- Natural Spline
- ???????? M1Mn0 Matrix ???????????? n-2 ?????
??? n-2 Unknown ?????? - ?????????????????????? Mi ?????????????????
Coefficient ???????? Polynomial ???
30Cubic Spline Int.(21)
- ?????????? Coefficient Matrix ??????????????????
Diagonal ??????????????? ???? Matrix ???????
Matrix ????? ????? Toeplitz Matrix - Toeplitz Matrix ????????????????? ?????? O(n2)
Computation Time ???????????? O(n3) - Algorithm ????????? Levinson Algorithm
- Toeplitz Matrix ???????? LU Decomposition ??????
O(n2) ???????????? - ?????????????????????????????? Matrix ??? ???
Levinson Algorithm ???????????????????????
????????????????????????????????????????? Linear
Algebra ??? Numerical Method
31Example Natural Spline
- ??????????????? ???????? Spline ??????? Fit Data
????????? n7, h 1, M0M70 - Yi 2 0 3 4 5 3 1 Xi 0 1 2 3 4 5 6
- ??????????? Matrix ??????
- ??????????????
32- ??????? Coefficient ??? Cubic ???? 6 ??????
33Polynomial Coefficient Matrix
- gtgt pa b c d
- p
- 1.4987 0 -3.4987 2.0000
- -2.4936 4.4962 0.9974 0
- 1.4756 -2.9846 2.5090 3.0000
- -1.4090 1.4423 0.9667 4.0000
- 1.1603 -2.7846 -0.3756 5.0000
- -0.2321 0.6962 -2.4641 3.0000
- ????????????? Plot ????? Polynomial ???????????
??????? 6 Polynomial ??? 6 ????
34Natural Spline Interpolation
35Natural Spline Interpolation RFirst Der G
Second Der B
36Natural Spline Interpolation RFirst D G
Second D B vs 6th D Poly K
?????????????? Polynomial ????? Degree ?????????
Overshoot ??? Spline ????? Curve ???????????????
????????????????????
37Regression
- ???????? Data ????????????? ?????? ????????
Interpolation ???? Polynomial ???????????? - ???????????? Data ????????????????????????????????
? ?????????????? Random - ???????????? Noise ????????
- ??? Fit ???? Polynomial ?????????? Spline
??????????????????????????????
38Regression Data with Noise
Y
X
39Polynomial Fit Noise Data
Y
X
40Ordinary Simple Linear Least-Squares Regression
- ???????? ?????????????????? Function ?????
??????????? ???? Exponential ????????????? - ????????????????????????????????????????
????????????? Data ?????????????????????????? - ??????????????? Fit ?????? ???????? Error ??????
????????????????? Regression - ??????????????????? (?????????????????)????????
Linear Regression - ?????????????? Simple Linear Regression
???????????????????? ??????????????????????????? - ??????????? Multiple Linear Regression
???????????????????????? ???????????? Linear
Equation ?????????? - ??????????????? yaxb (?????????? y a bx
???????????????????????? a ??? b
?????????????????????????) - Parameter 2 ??????????????? a slope ??? b
y-intercept
41Ordinary Simple Linear Least Square Regression
- ???????? Fit ???????????? Error ?????????
?????????????????? Least-Square ????? Ordinary
Least Square Regression (OLS) (???? Linear Least
Square) - ???????? Error ???????????????????????? Data
????????????????????? ??????????? - Linear Regression ???????????????????
???????????????????????????????? Random Variable
?????? - Linear Regression ????????????????????????? ???
OLS ????????????
42Linear Least-Squares Regression
Y
Error
X
43Ordinary Linear Least Square Regression (OLS)
- ??? a ??? b ????????????? Summation ??? Error
?????????? ????????? - ???????????????????????????? Derivative
????????????????????????? 0 (??? Minima) - ??????? Unknown ??? a ??? b ?????????????
Derivative ????????????????????????? 0 ?????? - df(a,b)/da 0
- df(a,b)/db 0
- f(a,b) ??? Sum of Square Error Function
- ???????????????????????????? r correlation
coefficient ????????????????????????????? Fit
????????????, r ?????????????? -1,1
44Linear Least-Squares Regression
Regression line
(xi,yi)
yi
ei
axib
xi
???????????? Data Pair (xi,yi) i 1,2,,n
??????? n ???
Variable X ??? Y ????????? ??????? Continuous
??? Discrete
45(No Transcript)
46R, r Correlation Coefficient
???? Correlation Coefficient ??? Pearson
Product-Moment Correlation Coefficient
?????????????????????????????? Covariance
?????????????? Standard Deviation ??????????
Variable (???????????) ??? ?????????????????????
r 1 ???? -1 ??????????????????????????????? ????
???????? (????????? ????????????) ??? r
???????????????????????????????????????
47Nonlinear Regression
- ??????????????????????????????????????
?????????????? Function ???????? Regression ???? - Exponential Model
- Power Equation
- Saturation-Growth-Rate Equation
- Polynomial Regression
- ?????????????????????????????
48Example
- 1. ???????????????????????? ???? CPE 332 ???????
????? ?????????????? ?????????????????????????????
???????????? ????????? ????????????????????????? - ????? OLS Regression ?????????????????????????????
??? ????? Plot Scatter Diagram ????????????????
??????????????? Correlation Coefficient
Data Hour Grade
1 5 72
2 8 51
3 2 86
4 6 75
5 4 88
Data Hour Grade
6 10 40
7 7 68
8 6 63
9 12 46
10 8 65
49Example
50Example
51y-5.0159x 99.5079
r -0.9069
52End of Chapter 12
- Download
- Homework 12 ????????????????? 12.00 ?.(??????????
???????? ???? 5-310)
53Course Ends
- Prepare For Exam
- ???????? 6 ??? ???????? (?????????????????????)
- ?????????? Midterm ?????????
- 1. Function Approximation (1 ???)
- Taylor Series/McLauren Series
- 2. Roots of Function (1 ???)
- Bisection
- Newton-Ralphson
- 3. Linear Equations (1 ???) ???????????????????
- Gauss Elimination
- Gauss Jordan (Including Matrix Inverse)
- Gauss Seidel
- LU Decomposition (Crout Decomposition)
54Course Ends
- Prepare For Exam
- 4. Numerical Integration (1 ???) ?????? Finite
Difference - Trapezoidal Rule
- Simpson 1/3 Rule
- Richardson Extrapolation
- 5. ODE (1 ???)
- Classical Forth Order RK Method ???????????
- 6. Curve Fitting (1 ???)
- Natural Spline
- OLS Regression
55Formulas
56END OF CPE 332 T1-56
- Minimum 40 ?????????????????????
- A ????????? 80 ??????