0% found this document useful (0 votes)
14 views6 pages

Curve Fitting and Interpolation Techniques

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)
14 views6 pages

Curve Fitting and Interpolation Techniques

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

INSTRUCTIONAL MATERIAL

___Engineering and Technology___

COLLEGE

1st Term; Academic Year 2022-2023

Module 4
CURVE FITTING AND INTERPOLATION

ON

MATH 315
NUMERICAL SOLUTION TO CE PROBLEMS

IFSU-LAG-INS-F008
Rev.00(Jan.03,2022)
i

CONTENTS
▪ Polynomial Interpolation
▪ Cubic and Quadratic Spline Interpolation
▪ Curve Fitting by Function Approximation
▪ Least squares Fit

IFSU-LAG-INS-F008
Rev.00(Jan.03,2022)
1

CHAPTER 4
CURVE FITTING AND INTERPOLATION
Learning Outcomes
▪ Interpolate spaced points to determine function by different techniques and
methods
▪ Find for the polynomial fitting a given set of data

Lesson Proper
I. CURVE FITTING
• The technique to fit curves to obtain intermediate estimates and compute values of
the function at a number of discrete values along the range of interest.
• is the process of constructing a curve, or mathematical function, that has the best
fit to a series of data points, possibly subject to constraints.
• also known as regression analysis, is used to find the "best fit" line or curve for a
series of data points. Most of the time, the curve fit will produce an equation that
can be used to find points anywhere along the curve

II. LEAST SQUARES FIT


A. Linear Regression
The simplest example of a least-squares approximation is fitting a straight line to a
set of paired observations: (x1, y1), (x2, y2), . . . , (xn, yn). The mathematical
expression for the straight line is

where a0 and a1 are coefficients representing the intercept and the slope,
respectively, and e is the error, or residual, between the model and the observations.
The error, or residual, is the discrepancy between the true value of y and the
approx imate value, a0 + a1x, predicted by the linear equation.
To determine values for a0 and a1,

is differentiated with respect to each coefficient:

Note that we have simplified the summation symbols; unless otherwise indicated, all
summations are from i = 1 to n. Setting these derivatives equal to zero will result in
a minimum Sr. If this is done, the equations can be expressed as

Now, realizing that Σa0 = na0, we can express the equations as a set of two
simultaneous linear equations with two unknowns (a0 and a1):

IFSU-LAG-INS-F008
Rev.00(Jan.03,2022)
2

These are called the normal equations. They can be solved simultaneously

This result can then be used in conjunction with previous equations to solve for

where y¯ and x¯ are the means of y and x, respectively.

Example 4.1 Fit a straight line to the x and y values in the first two columns of

The following quantities can be computed:

Using eqs.

Therefore, the least-squares fit is

The line, along with the data, is shown as

IFSU-LAG-INS-F008
Rev.00(Jan.03,2022)
3

B. POLYNOMIAL REGRESSION
Some engineering data, although exhibiting a marked pattern is poorly
represented by a straight line. For these cases, a curve would be better suited to fit
the data. One alternative is to fit polynomials to the data using polynomial regression.
The least-squares procedure can be readily extended to fit the data to a higher-
order polynomial. For example, suppose that we fit a second-order polynomial or
quadratic:

For this case the sum of the squares of the residuals is

Following the previous procedures, we take the derivative with respect to each of the
unknown coefficients of the polynomial, as in

These equations can be set equal to zero and rearranged to develop the following set
of normal equations:

where all summations are from i = 1 through n. Note that the above three equations
are linear and have three unknowns: a0, a1, and a2. The coefficients of the
unknowns can be calculated directly from the observed data.
For this case, we see that the problem of determining a least-squares second-
order polynomial is equivalent to solving a system of three simultaneous linear
equations.
The two-dimensional case can be easily extended to an mth-order polynomial
as

The foregoing analysis can be easily extended to this more general case. Thus, we
can recognize that determining the coefficients of an mth-order polynomial is
equivalent to solving a system of m + 1 simultaneous linear equations. For this case,
the standard error is formulated as

This quantity is divided by n − (m + 1) because (m + 1) data-derived coefficients— a0,


a1, . . . , am—were used to compute Sr; thus, we have lost m + 1 degrees of freedom.

IFSU-LAG-INS-F008
Rev.00(Jan.03,2022)
4

Example 4.2 Fit a second-order polynomial to the data in the first two columns of

From the given data,

Therefore, the simultaneous linear equations are

Solving these equations through a technique such as Gauss elimination gives a0 =


2.47857, a1 = 2.35929, and a2 = 1.86071. Therefore, the least-squares quadratic
equation for this case is

Assessment Tasks
Note: To be given in class

IFSU-LAG-INS-F008
Rev.00(Jan.03,2022)

Common questions

Powered by AI

Linear regression fits a straight line to the data points by minimizing the squares of the residuals between observed and predicted values. It is suitable for data with a linear relationship between dependent and independent variables. Polynomial regression, on the other hand, fits a polynomial curve to the data when it exhibits a pattern that is inadequately captured by a straight line. The least-squares method is extended in polynomial regression to fit higher-order polynomials, which involves solving a system of simultaneous linear equations to determine the coefficients of the polynomial .

Least-squares polynomial regression is preferred over linear regression in scenarios where the relationship between the independent and dependent variables is not linear. This includes cases where the data exhibits curvature, such as parabolic or higher degree patterns that a linear model cannot adequately capture. Polynomial regression is more flexible and can model complex datasets by fitting higher-order polynomial equations, providing a better approximation of the data curve that incorporates its non-linear characteristics .

In linear regression using the least-squares approximation, residuals represent the discrepancies between the observed values and the values predicted by the model. The goal of the least-squares method is to minimize the sum of the squares of these residuals. By differentiating the sum of squares with respect to the coefficients of the linear equation and setting the derivatives to zero, a system of normal equations is created. Solving these equations results in the optimal values of the coefficients that minimize the sum of squared residuals, thereby achieving the best fit line .

The steps involved in applying the least-squares method for fitting a straight line to a data set include: 1) calculate the mean of x and y values, 2) compute the sum of the squares of residuals between the observed y values and the y values estimated by the linear model, 3) take the derivative with respect to the line coefficients, 4) form the normal equations by setting the derivatives to zero, and 5) solve the normal equations, typically using algebraic methods like solving linear equations directly or using Gauss elimination to find the optimal line coefficients .

The computation of a least-squares quadratic equation is important in engineering contexts where the relationship between variables is not linear but can be approximated by a quadratic polynomial. This method allows for a more accurate fitting of data that obviously follow a parabolic pattern, thus enhancing prediction accuracy or modeling of natural phenomena. An example context is in structural engineering, where deflection patterns of beams under load can often be approximated by quadratic curves. The calculated quadratic equation can be used for simulations, stress analysis, and optimization of structural components .

Polynomial interpolation provides the advantage of giving an exact fit for functions known at discrete points, which can be beneficial for highly accurate prediction within the known data range. It smoothly interpolates between points, potentially yielding very accurate results for well-behaved datasets. However, its limitations include a tendency to oscillate wildly at the edges of an interval (Runge's phenomenon) and requiring a degree of polynomial that matches the number of points, which may lead to overfitting and numerical stability issues. Therefore, polynomial interpolation is often suited for small data sets where these challenges are manageable and less pronounced .

The coefficients of an mth-order polynomial in polynomial regression using the least-squares method are determined by solving a system of m+1 simultaneous linear equations derived from minimizing the sum of the squares of the residuals. The process involves taking the derivative of the sum of squares with respect to each polynomial coefficient, setting these derivatives to zero, and rearranging them into the normal equations form. These equations are then solved, often using techniques like Gauss elimination, to find the coefficients that best fit the data .

Curve fitting through function approximation involves creating a smooth curve that best represents the underlying pattern of a dataset without strictly passing through every individual data point. Unlike interpolation methods, which require the curve to pass exactly through all data points, curve fitting emphasizes minimizing overall deviations between the curve and points, often using the least-squares method. This approach is particularly useful when data has inherent variability or noise, as it provides a more generalized model that captures the trend rather than exact data point alignment .

Cubic and quadratic spline interpolation are used in curve fitting to create a smooth curve that passes through a set of given data points. The purpose is to maintain continuity and smoothness across intervals, which may be inadequately achieved by higher degree polynomial interpolation due to issues like Runge's phenomenon. Each piece of the spline is a low-degree polynomial, typically either cubic or quadratic, that achieves a smooth transition at data points by matching derivatives and curvature. This results in a more stable and visually appealing fit over the entire data set .

The Gauss elimination method is typically used to solve the normal equations derived in the least-squares polynomial fitting process. Solving the normal equations determines the coefficients of the polynomial that provides the best fit for the given data set .

You might also like