# Chapter 6

# Curve Fitting and Interpolation

**Core Topics**

Curve fitting with a linear equation (6.2).

Curve fitting with nonlinear equation by writing the equation in linear form (6.3).

Curve fitting with quadratic and higher order polynomials (6.4).

Interpolation using a single polynomial (6.5).

Lagrange polynomials (6.5.1).

Newton's polynomials (6.5.2).

Piecewise (spline) interpolation (6.6).

Use of MATLAB built-in functions for curve fitting and interpolation (6.7).

**Complementary Topics**

Curve fitting with linear combination of nonlinear functions (6.8).

## 6.1 BACKGROUND

Many scientific and engineering observations are made by conducting experiments in which physical quantities are measured and recorded. The experimental records are typically referred to as data points. For example, the strength of many metals depends on the size of the grains. Testing specimens with different grain sizes yields a discrete set of numbers (*d* – average grain diameter, σ_{y} – yield strength) as shown in Table 6-1.

Table 6-1: Strength-grain size data.

Sometimes measurements are made and recorded continuously with analog devices, but in most cases, especially in recent years with the wide use of computers, the measured quantities are digitized and stored as a set of discrete points.

Once the data is known, scientists and engineers can use it in different ways. Often the data is used for developing, or evaluating, ...