0% found this document useful (0 votes)
11 views11 pages

App Lecture 4

Uploaded by

Upasana Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views11 pages

App Lecture 4

Uploaded by

Upasana Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Method of Least Squares

The equation is y=a+bx+cx2 and the normal equations are


1. ∑y=an+b∑x+c∑x2

2. ∑xy=a∑x+b∑x2+c∑x3
3. ∑x2y=a∑x2+b∑x3+c∑x4
Examples

Calculate Fitting second degree parabola - Curve fitting using Least square
method

X Y
1 -5
2 -2
3 5
4 16
5 31
6 50
7 73

Solution:
The equation is y=a+bx+cx2 and the normal equations are

∑y=an+b∑x+c∑x2

∑xy=a∑x+b∑x2+c∑x3

∑x2y=a∑x2+b∑x3+c∑x4

The values are calculated using the following table


x y x2 x3 x4 x⋅y x2⋅y
1 -5 1 1 1 -5 -5
2 -2 4 8 16 -4 -8
3 5 9 27 81 15 45
4 16 16 64 256 64 256
5 31 25 125 625 155 775
6 50 36 216 1296 300 1800
7 73 49 343 2401 511 3577
--- --- --- --- --- --- ---
∑x=28 ∑y=168 ∑x2=140 ∑x3=784 ∑x4=4676 ∑x⋅y=1036 ∑x2⋅y=6440

Substituting these values in the normal equations


7a+28b+140c=168

28a+140b+784c=1036

140a+784b+4676c=6440

Solving these 3 equations,


Total Equations are 3

7a+28b+140c=168→(1)

28a+140b+784c=1036→(2)

140a+784b+4676c=6440→(3)

Select the equations (1) and (2), and eliminate the variable a.

7a+28b+140c=168 ×4→ 28a + 112b + 560c = 672



28a+140b+784c=1036 ×1→ 28a + 140b + 784c = 1036

- 28b - 224c = -364 →(4)

Select the equations (1) and (3), and eliminate the variable a.

7a+28b+140c=168 ×20→ 140a + 560b + 2800c = 3360



140a+784b+4676c=6440 ×1→ 140a + 784b + 4676c = 6440

- 224b - 1876c = -3080 →(5)

Select the equations (4) and (5), and eliminate the variable b.

-28b-224c=-364 ×8→ - 224b - 1792c = -2912



-224b-1876c=-3080 ×1→ - 224b - 1876c = -3080

84c = 168 →(6)

Now use back substitution method


From (6)
84c=168

⇒c=16884=2

From (4)
-28b-224c=-364

⇒-28b-224(2)=-364
⇒-28b-448=-364

⇒-28b=-364+448=84

⇒b=84-28=-3

From (1)
7a+28b+140c=168

⇒7a+28(-3)+140(2)=168

⇒7a+196=168

⇒7a=168-196=-28

⇒a=-287=-4

Solution using Elimination method.


a=-4, b=-3, c=2

Now substituting this values in the equation is y=a+bx+cx2, we get

y=-4-3x+2x2

The exponential equation is y=a ebx


taking logarithm on both sides, we get

log10y=log10(aebx)

log10y=log10a+log10ebx

log10y=log10a+bxlog10e

Y=A+Bx where Y=log10y,A=log10a,B=blog10e

which linear in Y,x

So the corresponding normal equations are

∑Y=nA+B∑x
∑xY=A∑x+B∑x2

Examples

Calculate Fitting exponential equation (y=aebx) - Curve fitting using Least


square method

X Y
0 0.10
0.5 0.45
1 2.15
1.5 9.15
2 40.35
2.5 180.75

Solution:

The curve to be fitted is y=a ebx

taking logarithm on both sides, we get


log10y=log10a+bxlog10e

Y=A+B x where Y=log10y, A=log10a, B=blog10e

which linear in Y, x
So the corresponding normal equations are
∑Y=nA+B∑x

∑xY=A∑x+B∑x2

The values are calculated using the following table


x y Y=log10(y) x2 x⋅Y
0 0.1 -1 0 0
0.5 0.45 -0.3468 0.25 -0.1734
1 2.15 0.3324 1 0.3324
1.5 9.15 0.9614 2.25 1.4421
2 40.35 1.6058 4 3.2117
2.5 180.75 2.2571 6.25 5.6427
--- --- --- --- ---

∑x=7.5 ∑y=232.95 ∑Y=3.81 ∑x =13.75


2
∑x⋅Y=10.4556

Substituting these values in the normal equations


6A+7.5B=3.81

7.5A+13.75B=10.4556

Solving these two equations using Elimination method,


we obtain A=-0.9916, B=1.3013

∴a=antilog10(A)=antilog10(-0.9916)=0.102

and b=Blog10(e)=1.3013(0.4343)=2.9963

Now substituting this values in the equation is y=aebx, we get

y=0.102e2.9963x

The exponential equation is y=abx


taking logarithm on both sides, we get

log10y=log10(abx)

log10y=log10a+log10(bx)

log10y=log10a+xlog10b

Y=A+Bx where Y=log10y,A=log10a,B=log10b

which linear in Y,x


So the corresponding normal equations are

∑Y=nA+B∑x

∑xY=A∑x+B∑x2
Examples

Calculate Fitting exponential equation (y=abx) - Curve fitting using Least


square method
X Y
0 10
1 21
2 35
3 59
4 92
5 200
6 400
7 610

Solution:
The curve to be fitted is y=abx

taking logarithm on both sides, we get


log10y=log10a+xlog10b

Y=A+Bx where Y=log10y, A=log10a, B=log10b

which linear in Y,x


So the corresponding normal equations are
∑Y=nA+B∑x

∑xY=A∑x+B∑x2
The values are calculated using the following table

x y Y=log10(y) x2 x⋅Y
0 10 1 0 0
1 21 1.3222 1 1.3222
2 35 1.5441 4 3.0881
3 59 1.7709 9 5.3126
4 92 1.9638 16 7.8552
5 200 2.301 25 11.5051
6 400 2.6021 36 15.6124
7 610 2.7853 49 19.4973
--- --- --- --- ---
∑x=28 ∑y=1427 ∑Y=15.2893 ∑x2=140 ∑x⋅Y=64.1929

Substituting these values in the normal equations


8A+28B=15.2893

28A+140B=64.1929

Solving these two equations using Elimination method,


we obtain A=1.0211, B=0.2543

∴a=antilog10(A)=antilog10(1.0211)=10.4986

and b=antilog10(B)=antilog10(0.2543)=1.7959

Now substituting this values in the equation is y=abx, we get

y=10.4986⋅(1.7959)x

The exponential equation is y=axb

taking logarithm on both sides, we get


log10y=log10(axb)

log10y=log10a+log10(xb)

log10y=log10a+blog10x

Y=A+bX where Y=log10y, A=log10a, X=log10x

which linear in Y, X

So the corresponding normal equations are

∑Y=nA+b∑X

∑XY=A∑X+b∑X 2

Example
Calculate Fitting exponential equation (y=axb) - Curve fitting using Least
square method

X Y
2 27.8
3 62.1
4 110
5 161

Solution:
The curve to be fitted is y=axb

taking logarithm on both sides, we get


log10y=log10a+blog10x

Y=A+bX where Y=log10y, A=log10a, X=log10x

which linear in Y,X

So the corresponding normal equations are


∑Y=nA+b∑X

∑XY=A∑X+b∑X2

The values are calculated using the following table

x y X=log10(x) Y=log10(y) X2 X⋅Y


2 27.8 0.301 1.444 0.0906 0.4347
3 62.1 0.4771 1.7931 0.2276 0.8555
4 110 0.6021 2.0414 0.3625 1.229
5 161 0.699 2.2068 0.4886 1.5425
--- --- --- --- --- ---

∑x=14 ∑y=360.9 ∑X=2.0792 ∑Y=7.4854 ∑X =1.1693


2
∑X⋅Y=4.0618

Substituting these values in the normal equations


4A+2.0792b=7.4854

2.0792A+1.1693b=4.0618

Solving these two equations using Elimination method,


we obtain A=0.868, b=1.9303

∴a=antilog10(A)=antilog10(0.868)=7.3791

Now substituting this values in the equation is y=axb, we get

y=7.3791⋅x1.9303

You might also like