Professional Documents
Culture Documents
Curve fitting: the process of finding the equation of the curve which best fits the
given values and is most suitable for predicting the unknown values.
Function approximation: The goal would be to come up with an approximating
functional form using a finite set of data points.
Way to solve:
1.Method of Group averages
2.Method of moments
Method of group of averages
Algorithm :
1. Line to be fitted for the data is y=ax+b; where a and b needs to be calculated.
2. Divide the set of data into two groups.
3. Compute the averages of x’s and y’s in two groups.
4. Substitute it to the line y=ax+b then solve for the value of a and b.
Example .
Fit a straight line 𝑦 = 𝑎 𝑥 2 + 𝑏𝑥 + 𝑐 to the ff. data.
X 0 2 4 6 8 10
y 6 9 12 14 17 20
Let 𝑦
= 𝑎 𝑥 + 𝑏𝑥 + 𝑐
2
1. take any point in the data , let say (2,9) as a point on the curve
y=ax2+bx+c eq.(1)
9=a(22) +b(2)+c
9=4a+2b+c eq. (2)
2.Subtracting eq.(1) to eq.(2) , we get ;
y-9 /x-2 = a(x+2) + b
3. Which is in the form of Y = aX + b eq(3)
(where Y=y-9/x-2 and X = x+2)
Divide the given data into two groups:
x y X=x+2 Y=y-9/x-2
0 6 2 1.5
2 9 4 0
4 12 6 1.5
total 12 3
x y X=x+2 Y=y-9/x-2
6 14 8 1.25
8 17 10 1.34
10 20 12 1.375
total 30 3.965
4a+b=1
10a+b=1.321
a=0.0535 , b=-0.786
9=4a+2b+c
9=4(0.0535) + 2(0.786) + c
c=7.214
So the required best fit for the data is y=0.0535 x2 + 0.786 x + 7.214
check: let x= 6;
y=o.o535 x2+ 0.786 x+ 7.214
y=o.o535 (6)2+ 0.786 (6)+ 7.214
y=13.856
Method of moments
Algorithm :
1. Let (x1 ,y1), (x2 ,y2), (x3 , y3),...(xn- yn-1) be n set of points or observation such that x
is equally spaced. i.e x2- x1=x3- x2
2. Let h=xn- xn-1.
3. Solve for the moment of y or (𝜇);
𝜇𝑚 = ℎ σ 𝑥 𝑚−1 𝑦
4. Let y=f(x) is a given curve.
5. Solve for the moment of calculated value or (γ);
ℎ
𝑥𝑛 −2
𝛾𝑚 = ℎ 𝑥 𝑚−1 𝑓 𝑥 𝑑𝑥
𝑥1 −
2
6. Assume; 𝜇𝑚 = 𝛾𝑚
ℎ
𝑥𝑛 − 2
ℎ σ 𝑥 𝑚−1 𝑦 = ℎ 𝑥 𝑚−1 𝑓 𝑥 𝑑𝑥
𝑥1 −2
example:
fit a straight line to the ff. data . X 1 2 3 4
y 16 19 23 26
Assume 𝜇𝑚 = 𝛾𝑚
4a + 10b = 84
10a + 33.33b = 227
By solving; a=13.2 and b=3.19
y= a + bx
y= 13.02 + 3.19 x answer