Optimal Design of Energy Systems
Chapter 4 Equation Fitting
Min Soo KIM
Department of Mechanical and Aerospace Engineering
Seoul National University
Chapter 4. Equation Fitting
4.1 Mathematical Modeling
performance characteristics of equipment behavior of processes
thermodynamic properties
• Equation development is required
Facilitate the process of system simulation
Develop a mathematical statement for optimization
4.2 Matrices
Chapter 4. Equation Fitting
11 12 1
1 2
n
m m mn
a a a
a a a
Order of matrix
m n
A
T Transpose of a matrix [A]ex>
1 4 2 5 3 6 A
1 2 34 5 6
A T
Chapter 4. Equation Fitting
4.2 Matrices
• Simultaneous linear equations
1 2 3
1 2
1 2 3
2 3 6
3 1
4 2 0
x x x
x x
x x x
1 2 3
2 1 3 6
1 3 0 1
4 2 1 0
x x x
Chapter 4. Equation Fitting
4.2 Matrices
• Determinant
11 12 13
21 22 23
31 32 33
a a a
D a a a
a a a
11 22 33 12 23 31 13 21 3231 22 13 21 12 33 11 23 32
a a a a a a a a a a a a a a a a a a
11 11 21 21 13 31
a A a A a A
cofactor of
22 33 23 32
a a a a
a11 [( 1) ]
i
[ ]
i j ij
submatrix formed by striking out A
th row and j th column of A
Chapter 4. Equation Fitting
4.3 Solution of Simultaneous Equations
11 12 13 1 1
21 22 23 2 2
31 32 33 3 3
[ ][ ] [ ]
a a a x b
A X a a a x b B
a a a x b
1 1 1 1 2 2 1 3 3 1
2 1 1 2 2 2 2 3 3 2
3 1 1 3 2 2 3 3 3 3
a x a x a x b a x a x a x b a x a x a x b
Simultaneous linear equations
Matrix form
Chapter 4. Equation Fitting
4.3 Solution of Simultaneous Equations
1 2 3
2 1 1 3
1 2 2 9
1 0 3 0
x x x
[ ] [ ] i
i
A matrix with B matrix substituted in th column
x A
ex>
1
3 1 1
9 2 2
0 0 3 45
2 1 1 15 3
1 2 2
1 0 3
x
2
2 3 1
1 9 2
1 0 3 2 1 1 2
1 2 2
1 0 3
x
3
2 1 3
1 2 9
1 0 0
2 1 1 1
1 2 2
1 0 3
x
• Crammer’s rule
Chapter 4. Equation Fitting
4.3 Solution of Simultaneous Equations
Coefficient matrix [A]
Triangular matrix
Back substitution
• Gaussian elimination
Chapter 4. Equation Fitting
4.4 Polynomial representation
2
0 1 2
n
y a a x a x a x
n# of data point = n+1 → exact expression
> → best fit
Chapter 4. Equation Fitting
4.6
Simplification when the independent variable is uniformly spaced Points are equally spaced
Derive 4th degree polynomial
n=4
2
0 1 0 2 0
3 4
3 0 4 0
( ) ( )
( ) ( )
n n
y y a x x a x x
R R
n n
a x x a x x
R R
1 0 n n 1
x x x x x
2
0 1 2
n
y a a x a x a xn
(next page)
Eq. (4.16) 4
x
Chapter 4. Equation Fitting
4.6
Simplification when the independent variable is uniformly spacedChapter 4. Equation Fitting
4.6
Simplification when the independent variable is uniformly spaced2 3 4
1 0 1 0 1 0 1 0
1 1 2 3 4
1 2 3 4
4(x x ) 4(x x ) 4(x x ) 4(x x )
y a a a a
R R R R
a a a a
0 0
1 1 1 2 3 4
2 2 1 2 3 4
3 3 1 2 3 4
4 4 1 2 3 4
, ,
, 2 4 8 1 6
, 3 9 2 7 6 4
, 4 1 6 6 4 2 5 6
x x y y
x x y y a a a a
x x y a a a a
x x y a a a a
x x y a a a a
if substitute (x1,y1)
Substitute all the points to Equation (4.16)
Chapter 4. Equation Fitting
2
0 1 2
y a a x a x
4.7 Lagrange Interpolation
1( 2)( 3) 2( 1)( 3) 3( 1)( 2)
y c x x x x c x x x x c x x x x
1, 1 1( 1 2)( 1 3)
x x y c x x x x
2, 2 2( 2 1)( 2 3)
x x y c x x x x
3, 3 3( 3 1)( 3 2)
x x y c x x x x
1 1
( ) ( )
( ) ( )
n n
j i
i
i j i j i i
x x ommiting x x
y y
x x ommiting x x
Chapter 4. Equation Fitting
4.8 Function of two variables
2
1 : 1 1 1 1
S P a b Q c Q
2
2 : 2 2 2 2
S P a b Q c Q
2
3 : 3 3 3 3
S P a b Q c Q
2
0 1 2
2
0 1 2
2
0 1 2
( ) ( ) ( )
a S A A S A S b S B B S B S c S C C S C S
( ) ( ) ( ) 2
P a S b S Q c S Q
Chapter 4. Equation Fitting
4.9 Exponential Forms
ln ln ln
y bxm
y b m x
y b axm
If y approaches some value b, as orx x
Estimate b
Calculate m with log-log plot (y-b vs. x) Fitting (y vs. xm)
Correct value of b
Log-log plot (y=bxm)
Curve y=b+axm
Chapter 4. Equation Fitting
4.10 Best fit : Method of Least Squares
The sum of the squares of the deviation is a minimum
Misuse of least square method Example of least square method
Misuses of least square method
(a) Questionable correlation (b) Applying too low degree
Chapter 4. Equation Fitting
4.10 Best fit : Method of Least Squares
• Method of least squares for y a bx
2( i i) 0
z a bx y
a
2 1
( ) min
m
i i
i
z a bx y
2( i i) i 0
z a bx y x
b
i i
ma b x y
2
i i i i
a x b x x y
Chapter 4. Equation Fitting
4.10 Best fit : Method of Least Squares
<Example> provide a best fit (least square)
<Solution>
0 1
y a a x
0 1
4a 14a 49.9
x y
1 4.9
3 11.2
4 13.7
6 20.1
0 1
14a 62a 213.9
1.908 3.019
y x
Chapter 4. Equation Fitting
4.10 Best fit : Method of Least Squares
• Method of least squares for y a bx cx2
2
2 3
2 3 4 2
1 i i i
i i i i i
i i i i i
a b x c x y
a x b x c x y x
a x b x c x y x
sin ln y a x b x
(sin ) 2
(ln ) 2
(sin ) (ln ) sin
(sin ) (ln ) ln
i
i
x
i i i i
x
i i i i
a x b x y x
a x b x y x
• For
Chapter 4. Equation Fitting
4.11 Method of Least Squares Applied to Nonpolynomial Forms
• Method of least squares
→ apply to equation with constant coefficients cf)
y sin 2 ax bx
cChapter 4. Equation Fitting
4.12 The are of equation fitting
• Choice of the form of the equation
Polynomials with negative exponent(1) Exponential eq.(2)
Gompertz eq(3) combination
, 1
cx
y ab where b c
(1) (2) (3)