Interpolation and Curve Fitting of Experimental Data

Kossi Edoh, North Carolina A & T State University, Mathematics and Statistics
Author Profile
Initial Publication Date: October 7, 2025

Summary

Interpolation and curve fitting are fundamental numerical techniques used to approximate unknown values and establish mathematical models for experimental data. Curve fitting provides a function that best represents the overall trend of the data, without necessarily passing through all the points, and allowing for measurement noise and uncertainty. However, interpolation provides a function that passes through all the given data. In the project, students will apply polynomial interpolation, spline interpolation, and least-squares curve fitting (linear, polynomial, and nonlinear) to a given dataset using MATLAB.


Learning Goals

In this activity, students will implement polynomial and spline interpolation on a given dataset, for example, the US population. In addition, they will perform linear, quadratic, cubic, or nonlinear curve fitting on the same dataset. Students will compare interpolation and curve fitting methods in terms of accuracy and smoothness, visualize, and interpret the results.

Context for Use

The education level of the project is college freshmen and sophomore of a class size of 50. It could be a laboratory activity or a homework project. Students are expected to have basic knowledge of MATLAB programming and Calculus I or its equivalent. This project is for numerical analysis students and can be assigned to the students around the middle of the semester.

Description and Teaching Materials

Students will explore interpolation and curve-fitting methods that best approximate a curve for a given set of data points. Students will use splines of order 4 or less and compare their accuracy. They will implement curve-fitting methods and compare them in terms of accuracy and smoothness. Students will use visualization to explore the accuracy of methods




Teaching Notes and Tips

This project is individual or group-based. It is a classroom-based activity that can be extended to Lagrange interpolation, higher-order splines, and nonlinear curve fitting. It is assumed that students have been introduced to these topics earlier in the semester. They will be given three different datasets. Students will construct a polynomial of degree n-1 and Cubic splines of piecewise polynomials ensuring smoothness at knots. They will be asked to find curves that best represent the points using Linear, Quadratic, Cubic, or Non-Linear regression. For example, the exponential function y = a*exp(bx) using MATLAB's fit() function.

Students will use MATLAB functions: polyfit, polyval, spline, fit, plot, and Goodness of fit, evaluated using the coefficient of determination (R²) and residual error.

Tools to be used:
- MATLAB functions: polyfit, polyval, spline, fit, plot.
- Goodness of fit evaluated using the coefficient of determination (R²) and residual error.

Students will be provided a final report detailing the results expected from them.


Assessment

The rubric for the project will have the following criteria:
A scoring scale of 1 -5, where 5 means excellent and 0 means poor.

The results should show the following:

Interpolation
- Polynomial interpolation produces an exact fit but oscillations for higher degrees.
- Cubic spline interpolation produced smoother curves without oscillations.

Curve Fitting

- Linear fit captured the overall trend but underestimated curvature.
- Quadratic and cubic fits improved accuracy significantly.
- Nonlinear exponential fit provided the best match, with R².

4.3 Graphical Comparison

Figures generated in MATLAB should be inserted here.
- Plot 1: Polynomial interpolation
- Plot 2: Cubic spline interpolation
- Plot 3: Linear, quadratic, cubic curve fitting
- Plot 4: Nonlinear exponential fitting

References and Resources

1. Chapra, S. C., & Canale, R. P. Numerical Methods for Engineers. McGraw-Hill.
2. MathWorks Documentation: Interpolation (https://www.mathworks.com/help/matlab/ref/interp1.html), Curve Fitting Toolbox (https://www.mathworks.com/help/curvefit/).
3. Burden, R. L., & Faires, J. D. Numerical Analysis. Brooks Cole.