8

Curve Fitting

8.0 INTRODUCTION

Quite often in engineering and science, we conduct experiments involving two quantities, say x and y. Suppose x1, x2, ...,xn be the values of x corresponding to which the values of y are y1, y2 ..., yn. We would like to know the functional relation between x and y. As a first step we plot the points (x1, y1), (x2, y2), .... (xn, yn) with respect to rectangular axes. The resulting set of points plotted is called a scatter diagram. From the scatter diagram it is possible to visualize a smooth curve which passes as closely as possible to these points and that approximates the data. Such a curve is called an approximating curve.

The equation of this curve between x and y is called an empirical relation.

For example, in the scatter diagram if the points cluster around a straight line, then we say that a linear relationship exists between x and y. If the points cluster around a curve, then we say a non–linear relationship exists between x and y.

The general problem of finding the equation of the approximating curve that fits the given set of data is called curve fitting.

C08F001

If the relation is linear, then we assume the empirical relation of the approximating curve as y = ax + b.

The best values of the constants occurring in the equation can be found in different ways. We shall fit a curve by the following methods:

  1. method of least squares
  2. method of averages
  3. method of the sum of exponentials
  4. method of moments
8.1 METHOD OF LEAST SQUARES

Let (x1, y1), (x2, y2), ..., (xn, yn) be a set of observed data and let y = f (x) be the relation suggested by the scatter diagram.

Let Pi be the point (xi, yi), i = 1,2, 3, ..., n

When x = xi, the observed value is yi and the expected value is f (xi).

Let di = yif (xi) be the difference between the observed and expected values for each i.

The differences d1, d2, ..., dn are called the residuals, which may be positive or negative

Eqn1

The principle of least squares is that the sum of the squares of the residuals is minimum.

It is also referred as Gauss’s least square principle.

The curve fitted by this principle is called the least square curve.

C08F002

The curve for whichEqn2 is minimum is called a best fitting curve besides all the curves approximating the given set of points.

A line fitted by this principle is known as least-square line and a parabola fitted by this principle is known as least square parabola.

Note: The method of least squares gives unique values for the constants and so the curve fitted is unique.

8.1.1 Fit a Straight Line by the Method of Least Squares

Let (x1, y1), (x2, y2) ... (xn, yn) be a set of observed values of the variables x and y.

Let the relation between x and y be y = ax + b(1)

Then, the sum of squares of residuals is

Eqn3

By principle of least squares E is minimum.

Since xi and yi are known, E is a function of a and b.

The conditions for E to be minimum are Eqn4 and Eqn5

Eqn6

and

Eqn7(2)

Eqn8

Eqn9(3)

Solving (2) and (3), we get the values of a and b.

For these values of a and b, the line y = ax + b is the best fitted line to the data.

The equations (2) and (3) are called the normal equations for the least–squares line

y = ax + b

Note:

  1. The formulae can be remembered by omitting the suffixes:

    The line is y = ax + b (1)

    The normal equations are Σy = aΣx + nb

    and Σxy = aΣx2 + bΣx

  2. If the values of x are equally spaced with interval h, we can simplify the computation by changing the origin and scale by the transformation

    Eqn12 so that Eqn13

WORKED EXAMPLES

Example 1

Use the method of least squares to fit a straight line to the following data:

x 0 5 10 15 20
y 7 11 16 20 26

Estimate the value of y when x = 25.

Solution

We fit a straight line to the given data by the method of least squares.

Since the values of x are equally spaced, let Eqn14

Then the equation of the line of best fit is

y = aX + b (1)

Normal equations are Eqn15 (2)

and Eqn16 (3)

To find Eqn17 we form the table

C08F003

From the table Eqn19 Eqn20

Substituting in (2), we get 80 = a.0 + 5b Eqn21

Substituting in (3), we get 47 = a.10 + b.0 ⇒ Eqn22

⇒ the equation of the line of best fit is

Eqn23

Eqn23a

When x = 25, y = 0.94(25) + 6.6 = 30.1

Example 2

In a tensile test of a metal bar the following observation were made where x represents load in tons and y elongation in ten thousands of an inch.

x

1

2

3

4

5

6

y

14

27

41

56

68

75

Using the principle of least squares, find a law of the form y = ax + b.

Solution

We fit a straight line by the principle of least squares.

Here the values of x are equally spaced with h = 1, but n = 6.

So, we choose the origin as the average of the two middle values 3 and 4 and it is Eqn30

Let X = x – 3.5

Then, the equation of the line of best fit is y = aX + b

The normal equations are Eqn31 (2)

and Eqn32 (3)

C08F003

Eqn33

Substituting in (2), we get, Eqn34

Substituting in (3), we get, Eqn35

Eqn36

⇒ the equations of the line of best fit is

Eqn38

 

Example 3

Using 1964 as the origin obtain a straight line trend equation by the method of least squares.

Year

1960

1962

1963

1964

1965

1966

1969

Value

140

144

160

152

168

176

180

Find the trend value of the missing year 1961.

Solution

Let the year be denoted by x, and let the value be denoted by y

Let

X = x – 1964

Then, the equation of the straight line of best fit is

y = aX + b(1)

Eqn48 the normal equations are Eqn49 (2)

and

Eqn50 (3)

C08F003

Eqn51

⇒ The normal equations are

1120 = a.1 + 7b

⇒ 1120 = a + 7b (4)

and

412 = a × 51 + b.1

⇒ 412 = 51a + b(5)

(4) – 7 × (5) ⇒ 1120 – 2884 = a (1 – 357)

⇒ 356 a = 1764

a = Eqn52 = 4.955 = 4.96

Substituting in (4), we get

7b + 4.96 = 1120

⇒ 7b = 1120 – 4.96 = 1115.04

b = Eqn53

The straight line trend is y = 4.96X + 159.29

y = 4.96(x – 1964) + 159.24

When x = 1961,

y = 4.96 (1961 – 1964) + 159.29

y = 4.96(–3) + 159.29

y = –14.88 + 159.29 = 144.41

∴ the trend value for the year 1961 is 144.41.

8.1.1 (a) Fitting Other Type of Equations Reducible to the Form Eqn54

Certain types of equations can be reduced to the linear form by transformation of variables.

This process is usually called rectification.

Some of such equations are given below.

C08F003
C08F003

WORKED EXAMPLES

Example 4

An experiment on the life of a cutting tool at different cutting speeds gave the values given below.

Speed vft/min

350

400

500

600

Life Tin min.

61

26

7

2.6

It is known that v and T satisfy the relationship v = aT b. Using the method of least squares find the best values of a and b.

Solution

Given v = a Tb

Taking log to the base 10

log10 v = log10 a + b log10 T

Put Y = log10 v, A = log10 a, X = log10 T

Then, the equation is Y = A + bX (1)

which is linear in x and y.

The normal equations are

Eqn66 (2)

Eqn67 (3)

We form the table

C08F003

Substituting in (2) and (3), we get

C08F003

Example 5

The voltage v across a capacitor at time t seconds is given by the following table. Use the principle of least squares to fit a curve of the form v = aekt to the data.

t 0 2 4 6 8
v 150 63 28 12 5.6

Solution

Given v= aekt.

Taking log to base 10, we get

logl0v= log10 a + kt log10 e

Put Y= log10 v, A = log10 a, B = klog10e, Eqn72

∴ the equation is Y= A + BX (1)

By method of least squares, the normal equations are

Eqn73 (2)

and

Eqn74 (3)

We form the table

C08F003

Eqn76

Substituting in (1), we get 7.2499 = 5A + B.0

Eqn77

Substituting in (3), we get

–3.5759 = A.0 + B.10

Eqn97 Eqn78

A = 1.45 ⇒ log10 a = 1.45 ⇒ a = 101.45 = 28.184

B = –0.3576

k log10 e = –0.3576

Eqn79

= −0.3576 loge10

= −0.3576(2.30258) = −0.8234

v = 28.184 e–0.8234t

8.1.1 (b) Fit a Parabola y = ax2 + bx + c by the Method of Least Squares

Let (Eqn80), (Eqn81), … (Eqn82) be n observed values of x and y.

We have to fit the parabola y = ax2 + bx + c (1)

to this data

The sum of the squares of the residuals is

Eqn83

Since xi and yi. are known, E is a function of a, b, c.

By principle of least squares E is minimum.

Eqn84 the conditions are Eqn85

Eqn97 Eqn86

Eqn87

Eqn88 (2)

Similarly, Eqn89 (3)

and Eqn90 (4)

Solving (2), (3) and (4) we get the values of a, b, c for which the curve y = ax2 + bx + c is the best fitted curve to the data.

Note: Dropping the suffixes, for simplicity, the normal equations of the least square curve

y = ax2 + bx + c(1)

are Σy = aΣx2 + bΣx + nc(2)

Σxy = aΣx3 + bΣx2 + cΣx(3)

Σx2y = aΣx4 + bΣx3 + cΣx2(4)

They can be remembered as below

Taking Σ of (1) we get (2)

Multiply (1) by x and then taking Σ, we get (3)

Multiplying (1) by x2 and then taking Σ, we get (4).

WORKED EXAMPLES

Example 1

Fit a parabola of the form y = ax2 + bx + c to the following data:

x 0 1 2 3 4
y 1 1.8 1.3 2.5 6.3

Solution

We fit a parabola to the given data by the method of least square.

The values of x are equally spaced with h = 1

For simplicity in computation we take origin for x.

Put

X = x − 2.

Then the equation of the curve of best fit is

y = aX2 + bX + c (1)

The normal equations are

Eqn95 (2)

Eqn95a (3)

Eqn95b (4)

We form the table

C08F003

Eqn96

Substituting in (2), we get 12.9 = 10a + b.0+5c

Eqn97 10a + 5c = 12.9

Eqn98 2a + c = 2.58 (5)

Substituting in (3), 11.3 = a.0 + b(10) + c.0

Eqn99 10 b = 11.3 Eqn100 b = 1.13

Substituting in (4), 33.5 = a.34 + b.0 + c.10

Eqn101 34a + 10c = 33.5

Dividing by 10, 3.4a + c = 3.35 (6)

(6) – (5) Eqn103 1.4a = 0.77

Eqn104 Eqn105

Substituting in (5), we get c = 2.58 − 2(0.55) = 2.58 – 1.10 = 1.48

The curve of best fit is y = 0.55X2 + 1.13X + 1.48, where X = x – 2

Example 2

The following table gives the levels of prices in certain years. Fit a second degree parabola to the data:

Year

1975

1976

1977

1978

1979

1980

1981

1982

1983

1984

1985

Price

88

87

81

78

74

79

85

84

90

92

100

Solution

We fit a parabola, to the given data by the method of least squares.

Let x denote year and y denote price.

For year, take the origin as 1980. Let X = x – 1980.

Then the equation of the best fitted curve is

y = aX2 + bX + c (1)

The normal equations are

Eqn106 (2)

Eqn106a (3)

Eqn106b (4)

we form the table

C08F003

n = 11, Eqn107y = 938, Eqn108X = 0, Eqn109X2 = 110, Eqn110X3 = 0, Eqn111X4 = 1958, Eqn112Xy = 130, Eqn113X2y = 9910

Substituting in (3) we get, 130 = a.0 + b.110 + c.0 Eqn114

Substituting in (2), we get 938 = a × 110 + b.0 + 11 × c

Eqn115 110a + 11c = 938

Eqn116 10a + c = 85.2727(5)

Substituting in (4), 9910 = 1958a + 0.b + 110c

Eqn117 1958a + 110 c = 9910

Dividing by 110, 17.8a + c = 90.0909(6)

(6) – (5) Eqn118 7.8a = 4.8182

Eqn119

Thus a = 0.62, b = 1.18, c = 79.10

The curve of best fit is Eqn120 where X = x – 1880

Example 3

Fit a second degree parabola of the form y = ax2+ bx+ cto the following data taking xas the independent variable.

x

1

2

3

4

5

6

7

8

9

y

2

6

7

8

10

11

11

10

9

and introducing the new variable uand vby the equations u = x - 5, v = y - 7.

Solution

We fit a parabola to the given data by the method of least squares.

Since the given new variables are u and v and u = x – 5,v = y – 7, taking u as the independent variable, and v as the dependent variable the equation of the parabola in u and v is

v = au2 + bu + c (1)

The normal equations are

Eqn142(2)

C08F003

n = 9, Eqn143u = 0, Eqn144u2 = 60, Eqn145u3 = 0,

Eqn146u4 = 708, Eqn147v = 11, Eqn148uv = 51, Eqn149u2v = −9

Substituting in (2), (3) and (4), we get

11 = a × 60 + b × 0 + 9c

Eqn150 60a + 9c = 11

Eqn151

Eqn152 6.6667a + c = 1.2222 (5)

51 = a.0 + b.60 + c.0

Eqn153 60b = 51 Eqn154 b = Eqn155 = 0.85 (6)

and – 9 = a × 708 + b.0 + c × 60

Eqn157 708a + 60c = − 9

Eqn158 Eqn159a + c =Eqn160

Eqn161 11.8a + c = Eqn162 0.15 (7)

(7) − (5) Eqn163 5.1333a = Eqn1641.3722 Eqn163 Eqn165

(5) Eqn166 c = 1.2222 − 6.6667 × (–0.2673)

= 1.222 + 1.7820 = 3.0042

Eqn168 a = −0.2673, b = 0.85, c = 3.0042

Eqn169 v = –0.2673 u2 + 0.85u + 3.0042

Eqn170 y – 7 = −0.2673 (x – 5)2 + 0.85 (x – 5 ) + 3.0042

Eqn171 y = 7 – 0.2673 (x2 – 10x + 25) + 0.85x – 4.25) + 3.0042

Eqn172 y = – 0.2673x2 + 3.523x – 0.9283

Example 4

Fit a parabola of the form y = ax2+ bx+ cto the following data by the method of least squares and predict the value of ywhen x = 70.

X

71

68

73

69

67

65

66

67

Y

69

72

70

70

68

67

68

64

Solution

We have to fit a parabola of the form y = ax2 + bx + c by the method of least squares.

Let X = x – 67, Y = y –70

Eqn173 the equation is Y = aX2 + bX + c (1)

The normal equations are

Eqn174

we form the table

C08F003

n = 10, Eqn175X = 10, Eqn176, Eqn177X3 = 280,

Eqn178X4 = 1586, Eqn179XY = 6, Eqn180X2Y = –28

Substituting in (2), (3) and (4), we get

–12 = a × b2 + b × 10 + 8c

Eqn181 7.75a + 1.25b + c = –1.5(5) [Dividing by 8]

6 = a × 280 + b × 62 + c × 10

Eqn182 28a + 6.2b + c = 0.6 (6) [Dividing by 10]

and –28 = a × 1586 + b × 280 + c × 62

Eqn183 25.58a + 4.52b + c = –0.45 (7) [Dividing by 62]

(6) − (5) Eqn184 20.25a + 4.5b = 2.1

Eqn185 4.09 a + b = 0.4242 (8)

(6) – (7) Eqn186 2.42a + 1.68b = 0.15

Eqn187 1.44 a + b = 0.089 (9)

(8) – (9) Eqn188 2.65a = 0.3352 Eqn190 Eqn189

(9) Eqn190 b = 0.089 – 1.44 × 0.1265

= 0.089 – 0.182 = –0.093

c = 0.6 – 28 × 0.1265 – 6.2 (–0.093)

= 0.6 – 3.542 + 0.5766 = –2.3654

∴ The equation of the parabola is

Y = 0.1265 X2 – 0.093X – 2.3654

Eqn192 y – 70 = 0.1265 (x – 67 )2 − 0.093(x – 67) – 2.3654

Eqn193 y = 0.1265x2 – (0.093 + 16.95)x

+ 567.8585 + 6.231 – 2.3654 + 70

Eqn194 y = 0.1265x2 – 17.043 x + 641.724

When x = 70, y = 0.1265 × 702 – 17.043 × 70 + 641.724

Eqn194 y = 619.85 – 1193.01 + 641.724 = 68.564 = 69

Exercises 8.1

By method of least squares fit the indicated curve to the given data:

Fit a straight line to the data:

x

0

1

2

3

4

y

1

1.8

3.3

4.5

6.3

Fit a straight line to the data:

x

75

80

93

65

87

71

98

68

84

77

y

82

78

86

72

91

80

95

72

89

74

(3) Find the least square line for the data below:

x

1

2

4

6

8

9

11

14

y

1

2

4

4

5

7

8

9

smoothen the data in the above by using the least square line.

(4) The weights of calf taken at weekly intervals are supplied below. Fit a straight line and calculate the average rate of growth per week.

Age x

1

2

3

4

5

6

7

8

9

10

Weight y

52.5

58.7

65.0

70.2

75.4

81.1

87.2

95.5

102.2

106.4

(5) Fit a curve of the form y = ax + bx2 to the data:

x

1

2

3

4

5

y

1.8

5.1

8.9

14.1

19.8

Calculate y when x = 2.

Eqn461

(6) Given

x

2

4

6

8

y

5.5

14.5

26.2

41.8

Fit a law of the form y = ax + bx2 by computing the least square line.

Eqn195

(7) For the law of the Eqn197 + bx, find the best values of a and b from the following data

x

1

2

3

4

5

6

y

5.4

6.3

8.2

10.2

12.6

15

(8) Fit an equation of the form y = aebx for the data

x

1

2

3

4

y

1.65

2.70

4.50

7.35

(9) The pressure and volume of a gas are known to be related by the equation pv = c, a constant. In an experiment, the following volumes of quantity of gas were observed for the pressures specified. Fit the same equation taking P as independent variable.

P (kg/sq.cm)

0.5

1.0

1.5

2.0

2.5

3.0

v (litres)

1.62

1.00

0.75

0.62

0.52

0.46

Growth of bacteria (y) in a culture after x hours is given in the following table. Fit a curve of the form y = abx by method of least squares.

House x

0 1 2 3 4 5 6

No. of bacteria y

32 47 65 92 132 190 275

Estimate y when x = 7.

Find the least squares parabola for the data:

x 0 2 4 6 8 10
y 1 3 13 31 57 91

Find the least square parabola to the data:

x

0

1

2

3

4

y

1

5

10

22

38

Answers 8.1

(1) y = 1.33x + 0.72, (2) y = 0.66x + 29.13

(3) The least square line is y = 0.62x + 0.75

The estimated values of y obtained from this line corresponding to x = 1,2, … 9,11,14 are the smoothening values. The smoothened values of y are 1.37, 1.99, 3.23, 4.47, 5.71, 633, 7.57, 9.43

(4) y = 6.16 x + 45.74, rate of growth = 6.16 (5) When x = 2, y = 486

(6) Y = 1.95 + 0.41x and y = 1.95x + 0.41x2 (7) a = 2.7907, b = 2.413

(8) y = e0.4994x (9) Pv0.422 = 0.9972

(10) y = 32.15 (1.427)x ; when x = 7, y = 387 (11) y = x2 x + 1

(12) y = 2.2x2 + 0.3x + 1.4

8.2 METHOD OF GROUP AVERAGES

Let (x1, y1). (x2, y2), (x3, y3), … (xn,yn) be the set of observed values of the related variables x and y.

Let y = a + bx (1)

be the assumed linear relationship between the two variables.

To determine the constants a and b, we need two equations in a and b.

C08F003

When x = x1, the observed value of y is y1 and the estimated values of y from (1) is a + bx1

Their difference is called residual or deviation.

Thus d1= y1– (a + bx1) is the residual for the point (x1, y1).

Similarly for the other points we find the residuals

d2 = y2 – (a + bx2), d3 = y3 – (a + bx3), … dn = yn – (a + bxn)

Some of the residuals may be positive, some of them may be negative or zero. The method of group averages is based on the assumption that the sum of the residuals is zero. ie. Eqn200

Since we require two equations in a and b to find out the values of a and b, we divide the given data into two groups such that the sum of residuals is zero for each group.

Let the first group contain r observations, say, (x1, y1), (x2, y2), (x3, y3), … (xr,yr) and the second group contain remaining (n – r) observations.

Eqn201

Eqn202

Dividing by r, we get

Eqn203

Eqn190 Eqn204(2)

where

Eqn202

Eqn205

Similarly

Eqn202

Eqn206

Eqn207

Eqn202

Dividing by (n r),

Eqn208

Eqn209

where

Eqn210

Solving (2) and (3), we get a and b.

Substituting the values of a and b in (1), we get the line fitted to the data.

Note:

  • (1) Since Eqn211 and Eqn212 are the average values of x and y in the first group and Eqn213, Eqn214are the average values of x and y in the second group, the method is known as method of averages.
  • If we divide the data into two groups in a different way such that the sum of the residuals is zero in each group, then the values of a and b will be different, and so the equation will be different. This is the serious draw back of this method.
  • Since y = a + bx is satisfied by (Eqn215) and (Eqn216), this line is the line joining the points (Eqn215) and (Eqn216). So the equation of the line fitted to the data is Eqn219
  • (4) In practice, we divide the data into two groups which contain the same number of points.

WORKED EXAMPLES

Example 1

Fit a straight line of the form y = a + bx by the method of group averages for the following data:

x

0

5

10

15

20

25

y

12

15

17

22

24

30

Solution

Given 6 sets of values, we divide it into two groups each containing 3 sets of values.

new13

Eqn220Eqn220a

∴ the equation of the line fitted to the data is

Eqn221

Example 2

The weights of a calf taken at weekly intervals are given below. Fit a straight line by method of averages.

Age in weeks

1

2

3

4

5

6

7

8

9

10

Weight

52.5

58.7

65

70.2

75.4

81.1

87.2

95.5

102.2

108.4

Calculate also the average rate of growth per week.

Solution

Let x denote the age in weeks and y denote the corresponding weight.

We divide the given data of 10 values into two groups of 5 values each.

new13

Eqn223

Equation of the straight line fitted to data is

Eqn224

Eqn225

The rate of growth is Eqn226

Example 3

Experimental values of two connected quantities x, yare given below:

x

1

2

3

4

5

6

y

2.6

5.4

8.7

12.1

16

20.2

If the relation between x and y is y = ax + bx2 where a and b are constants, find the best values of a and b.

Solution

The given equation is y = ax + bx2

y = x (a + bx)

Eqn227

Put Eqn228 and X = x. Then the equation is Y = a + bX, which is linear in X and Y.

Divide the given set of 6 values into two groups of 3 values each.

new13

Eqn236

∴ the linear equation in X and Y is

Eqn237

Eqn238

Eqn238a

Example 4

The data in the following table fit a formula of the type y = axn. Find the values of aand nand the formula by the method of group averages.

x

10

20

30

40

50

60

70

80

y

1.06

1.33

1.52

1.68

1.81

1.91

2.01

2.11

Solution

Given y = axn

Taking log to the base 10,

log10 y = log10 a + n log10 x

Put Y = log10 y, X = log10 x and A = log10 a

∴ the equation is Y = A + nX, which is linear in X and Y.

Divide the given data into two groups of 4 values each.

new13

Eqn241 Eqn241a

∴ the equation in X and Y is

Eqn242

Eqn243

Eqn243a

Example 5

Fit a curve of the form Eqn244 to the following data by the method of averages.

x

8

10

15

20

30

40

y

13

14

15.4

16.3

17.2

17.8

Hence find the values of a and b.

Solution

Given Eqn245

Eqn246

Put Eqn247

∴ the equation is Y = aX + b, which is linear in x and y.

Divide the given data into two groups of 3 values each.

new13

Eqn265

∴the equation in X and Y is Eqn266

Eqn267

Type 2. Equations of the form y = a + bx + cx2

We reduce this equation to the above type and solve.

Let (x1,y1) be a particular point on y = a + bx + cx2 satisfying the equation.

Then, y1 = a + bx1 + cx12

Eqn268

Eqn269

Then, we get Y = b + cX, which is linear in X and Y.

We use group average method to find b and c.

Example 6

The data given below will fit a formula of the type y = a + bx + cx2. Find the formula.

x

87.5

84.0

77.8

63.7

46.7

36.9

y 292 283 270 235 197 181

Solution

Given y = a + bx + cx2(1)

Taking (87.5, 292) as a particular point on (1), we get

292 = a + b(87.5) + c(87.5)2(2)

(1) − (2)⇒ y – 292 = b[x – 87.5] + c[x2 – (87.5)2]

= (x – 87.5) [b + c(x + 87.5)]

Eqn270

Eqn271

To find b and c, we use the group average method.

Divide the given data into two groups of 3 values each.

new13

Eqn273

new13

Eqn275

∴ the equation in X and Y is Eqn276

Eqn277

Eqn277b

Eqn277c

= 0.00358(X−168.4)

= 0.00358X−0.6029

Y = 0.00358X+2.4197−0.6029

Y = 0.00358X+1.8168

Eqn278

Exercises 8.2

By the method of group averages fit the indicated curve.

(1) Fit y = ax + b to the data

x

50

70

100

120

y

12

15

21

25

(2) The following numbers relate to the flow of water over a triangular notch:

H

1.2

1.4

1.6

1.8

2.0

2.4

Q

4.2

6.1

8.5

11.5

14.9

23.5

H denotes the head of water (in feet), Q the quantity (in cubic feet) of water flowing per second. If the law is Q = CHn, find the best values of C and n.

[Hint: log10Q = log10C + nlog10H; put Y = log10Q, A = log10C, X = log10H

Y = A + nX]

(3) Fit a curve of the form y = kxn given:

x

25.9

259

2590

25900

y

0.308

0.209

0.148

0.098

(4) Fit a curve of the form y = a + bx + cx2 for the data:

x

2

2.5

3

3.5

4

4.5

5

5.5

6

y

18

17.8

17.5

17

15.8

14.8

13.3

11.7

9

Answers 8.2

(1) y = 0.19x + 2.1 (2) C = 2.6, n = 2.5

(3) y = 0.2673x0.0118 (4) y = 15.8 + 2.1x − 0.5x2

8.3 METHOD OF THE SUM OF EXPONENTIALS

We shall now discuss another type of curve fitting known as exponential curve fitting.

Let Eqn279 be the observed data for the variables x and y.

Let

Eqn280(1)

be the curve fitted to the data, where Eqn282 are constants to be determined. We shall assume n is fixed and is known.

We know that Eqn283 is the solution of the differential equation of the form

Eqn284(2)

where Eqn285 are unknown constants and Eqn286 are the roots of the auxiliary equation

Eqn287(3)

By Froberg’s method (1965), we can compute the derivatives numerically at the n points and substitute in (2) which will result in a system of n linear equations in the n unknowns Eqn288 which can be solved. Then Eqn289 can be obtained and finally Eqn290 can be obtained from (1) by the method of least squares or the method of averages.

Thus Eqn291 is fitted to the given data

Note: The drawback of this method is the unreliability of the results, because of the accuracy of the derivatives decreases as the order n increases.

We shall now discuss a method given by Moore in 1974 which gives more reliable results. For simplicity, we shall consider the case when Eqn292.

Let the curve to be fitted to the data be

Eqn293(4)

This function is the solution of the second order differential equation

Eqn294(5)

where Eqn295 are constants to be determined and Eqn296 are the roots of the auxiliary equation

Eqn297.

Let ‘a’ be the initial value of x.

Integrating (5) w.r.to x, we get

Eqn298

where

Eqn299

Again integrating w.r.to x, we get

Eqn300

Eqn300a

We know the formula

Eqn301(6)

Let Eqn302 and Eqn303 be two data points such that Eqn304, then

Eqn305(7)

and Eqn306(8)

Eqn307

Taking two different Eqn308 and evaluating these integrals by numerical method, say Simpson’s Eqn309 rule, we get two linear equations in Eqn310 and Eqn311.

Solving these equations, we get Eqn312 and Eqn313.

Solving Eqn314, we get the values of Eqn315 and Eqn316.

Finally, we find the values of Eqn317 and Eqn318 by the method of least squares or averaging method.

Thus Eqn319 is fitted to the data.

WORKED EXAMPLES

Example 1

Fit a function of the form Eqn320 to the following data.

x

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

y

1.175

1.336

1.510

1.698

1.904

2.129

2.376

2.646

2.942

Solution

The curve Eqn321 fitted to the given data is the solution of the differential equation

Eqn322

The auxiliary equation is

Eqn323(1)

Let Eqn324 be the roots of the auxiliary equation.

The coefficients Eqn325 are given by

Eqn326(2)

where a is the initial value of x and x1 and x2 are two data points such that

Eqn327

To evaluate the integrals, we use Simpson’s Eqn328 rule.

So, we choose Eqn329 such that there are even number of intervals.

⇒ choose Eqn330

Eqn331

Substituting in (2), we get

Eqn332

The given table is

x

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

y

1.175

1.336

1.510

1.698

1.904

2.129

2.376

2.646

2.942

Eqn332

We shall evaluate these integrals by Simpson’s Eqn333 rule

new20

Now take Eqn338 and Eqn339. We get Eqn340

Eqn341

We shall evaluate these integrals by Simpson’s Eqn342 rule.

new20

Eqn348

Substituting in (1), we get

Eqn349.png

We take Eqn350 and Eqn351

Eqn352

To find Eqn353 and Eqn354, we use the method of least squares

The sum of the squares of the residuals is

Eqn355

According to the method of least squares E is minimum if Eqn356 and Eqn357

Eqn358

Eqn359(5)

Eqn360(6)

The equations (5) and (6) are called the normal equations.

Now we shall form the table for computation

new20

Substituting in (5) and (6), we get

Eqn370

Dividing by 7.8267, we get

Eqn371(7)

and Eqn372

Dividing by 0.4838, we get,

Eqn373(8)

Eqn374

Substituting in (7), we get

Eqn375

Eqn376

which is the equation of the curve fitted to the given data.

Example 2

Fit a curve of the form whose equation is Eqn377.png, using the following data.

x

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

y

1.54

1.67

1.81

1.97

2.15

2.35

2.58

2.83

3.11

Solution

The curve given by y = A1eλ1x + A2eλ2x fitted to the data is the solution of the differential equation

Eqn465

The auxiliary equation is

λ2 = a1λ + a2(1)

Let λ1, λ2 be the root of the auxiliary equation

The co-efficients a1, a2 are given by

Eqn378

Where a is the value of x and x1, x2 are two data points such that

Eqn378

To evaluate the integrals, we use Simpson’s Eqn379 rule.

So, we choose Eqn380 in such way that there are even number of intervals between Eqn381 and Eqn382 and the last value of x

Eqn383 choose Eqn384 and Eqn385

Eqn383 Eqn386

Substituting in (2), we get

Eqn387

The given data is

x

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

y

1.54

1.67

1.81

1.97

2.15

2.35

2.58

2.83

3.11

Eqn388

We shall evaluate these integrals by Simpson’s Eqn389 rule.

new20

Eqn394

Eqn395

Dividing by 0.0604, we get

Eqn396

Now take Eqn397 and Eqn398

Eqn399

Substituting in (2), we get

Eqn400

We shall evaluate these integrals by Simpson’s Eqn401 rule

new20
new20

Dividing by 0.096, we get

Eqn407(4)

Eqn408

Substituting in (4), we get

Eqn409

Substituting in (1), we get

Eqn410

We take Eqn411 and Eqn412

Eqn413

We shall now find Eqn414, Eqn415 by the method of least squares.

The sum of the squares of the residuals is

Eqn416

According to the method of least squares E is minimum for the best fitted curve.

The normal equations are given by Eqn417 and Eqn418.

Eqn419(5)

Eqn420(6)

new20

Substituting in the normal equations (5) and (6), we get

Eqn430

Dividing by 9.3685, we get

Eqn431(7)

and

Eqn432

Dividing by 0.708, we get

Eqn433(8)

Eqn434

Substituting in (8), we get

Eqn435

Take A1 = 0.52, and A2 = 0.39

Eqn436

Which is the equation of the curve fitted to the given data.

Exercise 8.3

(1) Fit a curve of the form Eqn463 for the following data

x

2

2.2

2.4

2.6

2.8

3.0

3.2

3.4

3.6

y

3.63

4.46

5.47

6.70

8.19

10.02

12.25

14.97

18.29

Answer 8.3

(1) Eqn464

8.4 METHOD OF MOMENTS

Let (x1, y1), (x2, y2), … (xn, yn) be a set of n observations of the related variables x and y.

Let the values of x be equally spaced with interval h = Δx, say

ie. xixi = Δx for all i = 1, 2, 3, ..., n − 1.

For such a set of points, we define

the first moment μ1 = Σy Δx = Δx Σy

the second moment μ2 = Σ xy Δx = Δx Σ xy

the third moment μ3 = Σ x2y Δx = Δx Σx2y and so on.

These moments are called the moments of the observed values of y.

Let y = f(x)be the curve to be fitted the data.

Then, the first moment g1 = ∫y dx = ∫f(x) dx

the second moment g2 = ∫xy dx = ∫xf(x) dx

and the third moment g3 = ∫x2y dx = ∫x2 f(x) dx and so on.

These moments are called the moments of the computed values of y or expected values of y.

The method of moments is based on the assumption that the moments of the observed values of y is equal to the moments of the expected values of y.

i.e. mI = ri Eqn437

It can be proved that

Eqn438

These equations are known as observation equations.

If the form of f(x) is known, then using the observation equations the constants can be determined.

If f(x) is linear ie. f(x) = ax + b, then the equation of the curve fitted is y = ax + b

If Eqn439

Eqn440.png

Solving these two equations we find a and b and hence the equation y = ax+b

WORKED EXAMPLES

Example 1

By the method of moments, obtain a straight line to fit the data.

x

1

2

3

4

y

0.30

0.64

1.32

5.40

Solution

We fit a straight line to the given data by the method of moments.

Given values of x are equally spaced with Δx = 1.

Here x1 = 1, xn = 4

Eqn441

Let the line fitted be y = ax+b (1)

Then, the observation equations are

Eqn442

Now Eqn443

and Eqn444

Substituting in (2) and (3) we get

Eqn445

Eqn446(4)

and

Eqn447

30.333a + 10b = 27.14

Dividing by 10, 3.0333a + b = 2.714(5)

(5) − (4) ⇒ Eqn468

b = 1.915 − 2.5(1.499) = −1.8325

∴ the equation of the straight line is y = 1.499x - 1.8325

Example 2

By method of moments fit a straight line to the data:

x 1 2 3 4
y 0.17 0.18 0.23 0.32

Solution

We fit a straight line to the given data by the method of moments.

Given values of x are equally spaced with Eqn449

Eqn450

Let the line fitted be y = Eqn451(1)

Then, the observation equations are

Eqn452(2)

Eqn453(3)

Now Eqn454

Substituting in (2),

Eqn455

Eqn456(4)

Substituting in (3),

Eqn457

Eqn458(5)

Eqn459

Exercises 8.4

Fit a straight line by the method of moments to the following data:

x

1

2

3

4

y

16

19

23

26

Fit a straight line by the method of moments to the following data:

x

1

3

5

7

9

y

1.5

2.8

4.0

4.7

6.0

Fit a straight line by the method of moments to the following data:

x

1

2

3

4

y

1.7

1.8

2.3

3.2

Fit a straight line by the method of moments to the following data:

x 0 1 2 3 4 5
y 66.7 72.7 82.3 92.1 93 100

Answers 8.4

(1) y = 3.188x + 13.03 (2) y = 0.5231x + 1.1845

(3) y = 0.49x + 1.025 (4) y = 6.86x + 67.4

SHORT ANSWER QUESTIONS

1. What is meant by curve fitting?

2. State the principle of least square.

3. Define residual.

4. Write the normal equations to fit a straight line of the form Eqn27

5. Write down the normal equations to fit a quadratic curve by the method of least squares.

6. Define the method of group averages.

7. Convert the equation Eqn34_1 into a linear form where a and b are constants.

8. Convert Eqn38_1

9. Convert the equation Eqn43 into linear form.

10. Convert Eqn48_1 into linear form.

11. What is Gauss’s least square principal.

12. Convert Eqn52_1 into linear form.

13. Explain method of group Averages.

14. What is the defect of method of group averages?

15. How to avoid the defect of method of group averages?

16. Eqn59_1 is fitted by the method of moments.

17. Convert Eqn66_1 into linear form.

18. Convert Eqn71_1 into linear form.

19. Convert Eqn78_1 into linear form.

Eqn83_1 to a linear form and write the corresponding normal equations to fit it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.231.15