Formula
The equation is `y = a + bx + cx^2` and the normal equations are
|
1. `sum y = an + b sum x + c sum x^2`
|
2. `sum xy = a sum x + b sum x^2 + c sum x^3`
|
3. `sum x^2y = a sum x^2 + b sum x^3 + c sum x^4`
|
Examples
1. Calculate Fitting second degree parabola - Curve fitting using Least square method
Solution:
The equation is `y = a + bx + cx^2` and the normal equations are
`sum y = an + b sum x + c sum x^2`
`sum xy = a sum x + b sum x^2 + c sum x^3`
`sum x^2y = a sum x^2 + b sum x^3 + c sum x^4`
The values are calculated using the following table
`x` | `y` | `x^2` | `x^3` | `x^4` | `x*y` | `x^2*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 |
--- | --- | --- | --- | --- | --- | --- |
`sum x=28` | `sum y=168` | `sum x^2=140` | `sum x^3=784` | `sum x^4=4676` | `sum x*y=1036` | `sum x^2*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` | ` xx 4->` | | `` | `28a` | `+` | `112b` | `+` | `560c` | `=` | `672` | `` |
| | − | |
`28a+140b+784c=1036` | ` xx 1->` | | `` | `28a` | `+` | `140b` | `+` | `784c` | `=` | `1036` | `` |
| | |
|
| | | | | `-` | `28b` | `-` | `224c` | `=` | `-364` | ` -> (4)` |
Select the equations `(1)` and `(3)`, and eliminate the variable `a`.
`7a+28b+140c=168` | ` xx 20->` | | `` | `140a` | `+` | `560b` | `+` | `2800c` | `=` | `3360` | `` |
| | − | |
`140a+784b+4676c=6440` | ` xx 1->` | | `` | `140a` | `+` | `784b` | `+` | `4676c` | `=` | `6440` | `` |
| | |
|
| | | | | `-` | `224b` | `-` | `1876c` | `=` | `-3080` | ` -> (5)` |
Select the equations `(4)` and `(5)`, and eliminate the variable `b`.
`-28b-224c=-364` | ` xx 8->` | | | | `-` | `224b` | `-` | `1792c` | `=` | `-2912` | `` |
| | − | |
`-224b-1876c=-3080` | ` xx 1->` | | | | `-` | `224b` | `-` | `1876c` | `=` | `-3080` | `` |
| | |
|
| | | | | | | `` | `84c` | `=` | `168` | ` -> (6)` |
Now use back substitution method
From (6)
`84c=168`
`=>c=(168)/(84)=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=(-28)/(7)=-4`
Solution using Elimination method.
`a=-4,b=-3,c=2`
Now substituting this values in the equation is `y = a + bx + cx^2`, we get
`y = -4 -3x+2x^2`
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then