Module 3 Regression and Interpolation
Module 3 Regression and Interpolation
MA 311
MODULE 3: regression and
interpolation
Musango Lungu, D Eng
(4)
(5)
REGRESSION
Example 1
AND INTERPOLATION
A leaf filter has an area of 0.5 m2 and operates at a constant pressure drop of
500 kPa. The following test results were obtained for a slurry in water which
gave rise to a filter cake regarded as incompressible:
V (m3 ) 0.1 0.2 0.3 0.4 0.5
t/V (s/m3 ) 1400 1800 2000 2600 3000
where t is time (s), V is volume of filtrate (m3), A is the surface area (m2), rc
is the cake resistance, -Δp is the pressure drop (kPa), Veq is volume of
filtrate that creates a cake of certain thickness (m3), φ is the volume of cake
formed by passage of unit volume of filtrate and μ is viscosity of fluid
(Pa.s).
REGRESSION AND INTERPOLATION
• It can be seen that the filtration equation is in the form of
and thus we can obtain a0 and a1 by linear regression which corresponds
to and .
Solution
• Refer to excel sheet accompanying this PPT
• The coefficients a0 and a1 are thus determined to be 960 s/m3 and 4000
s/m6 .
• The quantities and are computed.
• Given values of φ and μ , one can also compute the cake resistance, rc .
REGRESSION AND INTERPOLATION
• Other graphing software like Origin Lab also compute linear regression.
REGRESSION AND INTERPOLATION
REGRESSION AND INTERPOLATION
• Matlab computes linear regression using the polyfit inbuilt function.
REGRESSION AND INTERPOLATION
Example 2
According to Charles’s law for an ideal gas, at constant volume, a linear
relationship exists between the pressure, p, and temperature, T. In an
experiment, a fixed volume of gas in a sealed container is submerged in
ice water ( T = OC). The temperature of the gas is then increased in ten
increments up to T = 100 OC by heating the water, and the pressure of the
gas is measured at each temperature. The data from the experiment is:
T, OC 0 10 20 30 40 50 60 70 80 90 100
P, atm 0.94 0.96 1.0 1.05 1.07 1.09 1.14 1.17 1.21 1.24 1.28
(7)
(8)
where
(10)
REGRESSION AND INTERPOLATION
Example 3: Application of least squares to develop a cost model for
the cost of heat exchangers
• Curve fitting of the costs of fabrication of heat exchangers can be used
to predict the cost of a new exchanger of the same class with different
design variables.
• Let the cost be expressed as a linear equation:
where
(14)
• In matrix notation :
(15)
(16)
REGRESSION AND INTERPOLATION
• Applying linear least-squares theory yields :
(17)
• Thus, the approach consists of solving the above equation which is
employed to compute improved values for the parameters:
• This procedure is repeated until the solution converges, i.e. satisfies the
convergence stopping criteria.
(18)
REGRESSION AND INTERPOLATION
• The Gauss-Newton method has a number of other possible
shortcomings:
(21)
• For Limestone
Example 6
• Estimate the natural logarithm of 2 using linear interpolation. First,
perform the computation by interpolating between ln 1 = 0 and ln 6 =
1.791759. Then, repeat the procedure, but use a smaller interval from ln
1 to ln 4 (1.386294). Note that the true value of ln 2 is 0.6931472.
REGRESSION AND INTERPOLATION
Quadratic interpolation
Determination of coefficients :
• For b0, equation 22 with x =x0 is used i.e.
(23)
• Equation 23 can now be substituted in equation 22 and evaluated at x
=x1 for
REGRESSION AND INTERPOLATION
(24)
(25)
(26)
• For an nth-order polynomial, n + 1 data points are required:
REGRESSION AND INTERPOLATION
• These data points and the following equations to evaluate the coefficients
(31)
• The second finite divided difference, which represents the difference of
two first divided differences, is expressed as:
(32)
(33)
REGRESSION AND INTERPOLATION
• These differences can be used to evaluate the coefficients in Eqs. (27)
through (29), which can then be substituted into Eq. (26) to yield
the interpolating polynomial:
(34)
where (36)
(37)
REGRESSION AND INTERPOLATION
• 2nd order version is:
(38)
(42)
• These equations can be used to evaluate the function at any point
between x1 and xn by first locating the interval within which the point
lies.
Solution
• For the 1st interval from x = 3.0 to x = 4.5:
REGRESSION AND INTERPOLATION
• For the 2nd interval from x = 4.5 to x = 7.0
(46)
• The condition that each of the cubics must join at the knots is applied.
• For knot i+1, this can be represented as:
REGRESSION AND INTERPOLATION
(47)
where
• First derivatives at the interior nodes must be equal. Equation 46
is differentiated to yield:
(48)
• Solving for di :
(52)
REGRESSION AND INTERPOLATION
• Substituting equation 52 into equation 47:
(53)
• Substituting equation 52 into equation 49 yields:
(54)
(55)
REGRESSION AND INTERPOLATION
• The index of equation 55 can be reduced by 1:
(56)
(58)
REGRESSION AND INTERPOLATION
• Equation 58 can be written for the interior knots, i = 2, 3, . . . , n − 2, which
results in n − 3 simultaneous tri-diagonal equations with n − 1 unknown
coefficients, c1 , c2 , . . . , cn–1 .
• With two additional conditions, we can solve for the c’s.
• Equations 55and 52 can be used to determine the remaining coefficients,
b and d.
• The two additional end conditions can be formulated in a number of ways.
• One common approach, the natural spline, assumes that the second
derivatives at the end knots are equal to zero.
• Thus the 2nd derivative at the first node [Eq.50] can be set to zero:
i.e. c1 = 0
REGRESSION AND INTERPOLATION
• Same evaluation can be made at the last node:
(59)
(60)
Example 8
• Fit a cubic spline to the data in Example 7. Utilize the results to estimate
the value of the function at x = 5.
REGRESSION AND INTERPOLATION
Solution
• Generate the set of simultaneous equations that will be utilized to
determine the c coefficients in the matrix:
END OF MODULE 3