Professional Documents
Culture Documents
EXERCICE 5.2
(a) Calculate fitting a straight line - Curve fitting using least square method
X Y
1 -5
1.2 -3
1.4 -2
1.6 0
1.8 3
Solution:
x y x2 x⋅y
1 -5 1 -5
1.2 -3 1.44 -3.6
1.4 -2 1.96 -2.8
1.6 0 2.56 0
1.8 3 3.24 5.4
--- --- --- ---
2
∑x=7 ∑y=-7 ∑x =10.2 ∑x⋅y=-6
5a + 7b = -7
and, 7a + 10.2b = -6
5a + 7b = -7→(1)
7a + 10.2b = -6→(2)
1
equation (2)×5 ⇒ 35a + 51b = -30
5a + 7(9.5) = -7
⇒5a = -7-66.5
⇒5a = -73.5
⇒a = -73.55
⇒a = -14.7
∴a = -14.7and b = 9.5
y = -14.7 + 9.5x
(b) Calculate Fitting a straight line - Curve fitting using Least square method
X Y
0 3
1 1.2
2 -0.3
3 -1.5
Solution:
x y x2 x⋅y
0 3 0 0
1 1.2 1 1.2
2 -0.3 4 -0.6
3 -1.5 9 -4.5
--- --- --- ---
∑x=6 ∑y=2.4
=2.4 ∑x2=14 ∑x⋅y=-3.9
2
Substituting these values in the normal equations
4a + 6b = 2.4
6a + 14b = -3.9
4a + 6b = 2.4
and, 6a + 14b = -3.9
4a + 6b = 2.4 → (1)
6a + 14b = -3.9 → (2)
Substracting ⇒-10b = 15
⇒10b = -15
⇒b = -1510
⇒b = -32
⇒b = -1.5
4a + 6(-1.5) = 2.4
⇒4a = 2.4+9
⇒4a = 11.4
⇒a = 11.44
⇒a = 2.85
∴a = 2.85and b = -1.5
y = 2.85 - 1.5x
3
EXERCICE 5.5
P1(1, 2.3); P2(2, 6.1); P3(3, 10.7); P4(4, 16.0); P5(5, 21.9); P6(6, 28.3)
Graphically the best guess function to suits the data is: h(x) = αxβ
X Y
1 2.3
2 6.1
3 10.7
4 16
5 21.9
6 28.3
4
Solution:
∑Y = nA + B∑x
∑xY = A∑x + B∑x2
6A + 21B = 6.1728
21A + 91B = 25.25
g(x) = 1.9942e0.4796x
5
For g(x) = αeβx, in which E(g) = ∑[g(xk) – yk]2
1 2.3 0.84915672
2 6.1 0.802454
3 10.7 5.25701071
4 16 5.84927865
5 21.9 0.00162660
6 28.3 51.03299975
X Y
1 2.3
2 6.1
3 10.7
4 16
5 21.9
6 28.3
Solution:
Which linear in Y, X
So the corresponding normal equations are
∑Y = nA + β∑X
∑XY = A∑X + β∑X2
1 2.3 0 0.3617 0 0
2 6.1 0.301 0.7853 0.0906 0.2364
3 10.7 0.4771 1.0294 0.2276 0.4911
6
4 16 0.6021 1.2041 0.3625 0.725
5 21.9 0.699 1.3404 0.4886 0.9369
6 28.3 0.7782 1.4518 0.6055 1.1297
6A + 2.8573β = 6.1728
2.8573A + 1.7748β = 3.5191
1 2.3 0.0000101
2 6.1 0.0005754
3 10.7 0.0002755
4 16 0.0008441
5 21.9 0.0001998
6 28.3 0.0008215
From the results of E(g) and E(h), we conclude that h(x) is better guess function to the presented data.