Interpolation

Your Progress in this Chapter

0%

0 / 10 units completed

Chapter Overview

Interpolation by Polynomial

Section 3.2 of 512 min5 code examples

Interpolation via Polynomial Fitting

While standard interpolation (like linear or Hermite) forces a curve to pass through every single data point, Polynomial Fit Interpolation uses a global model to approximate the data. This is particularly useful when you have many data points that might contain noise, or when you want a single mathematical expression to describe the entire dataset.

1. The Strategy

  • Modeling: Use Polyfit to find the coefficients of a polynomial of degree :math:N that best represents the data.
  • Estimation: Use Evaluate to calculate the value of that polynomial at any arbitrary point x.

2. Global vs. Local Interpolation

Example 1C#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Code is ready to run
OutputFrom the book
Polynomial_Interpolation_Ex1.png

Examples

.. Admonition:: Example 1 : Signal Denoising and Prediction

In sensor applications, individual readings often jump due to electronic noise.By fitting a low-degree polynomial to a window of data, you "smooth out" the noise.You can then interpolate to find values at high-frequency time steps that the sensor didn't actually record.

Example 2C#

1
2
3
4
5
6
7
8
9
Code is ready to run
OutputFrom the book
midvoltage = 1.0365000000000002

.. Admonition:: Example 2 : Structural Deformation Mapping

If you measure the deflection of a beam at 5 specific locations, a polynomial fit of degree 3 or 4 can describe the continuous "shape" of the beam.You can then use this model to interpolate the deflection at any other point along the beam's length.

Example 3C#

1
2
3
4
5
6
7
8
Code is ready to run
OutputFrom the book
Polynomial_Interpolation_Ex3.png

Exercise: Choosing the Degree

Task: Determine which degree :math:N is most appropriate for the data and evaluate.

Example 4C#

1
2
3
4
5
6
7
8
9
10
Code is ready to run

Multivariate Application

The idea of using polynomial fits can be extended to multiple dimensions. For example, if you have data points in 2D space (x, y) with corresponding values z, you can fit a polynomial surface to approximate z as a function of x and y. This is particularly useful in fields like geostatistics or thermodynamic property evaluation, where you want to model complex surfaces based on scattered data.

.. Admonition:: Example 4 : Thermodynamic Property Estimation

Example 5C#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Code is ready to run
OutputFrom the book
Interpolation by Polynomial Fitting
Specific volume at T = 1350 and P = 0.0373 is 28.053581185031376
Interpolation by Bilinear Interpolation
Specific volume at T = 1350 and P = 0.0373 is 20.413475
Interpolation by Polynomial Fitting-Using Narrow Region
Specific volume at T = 1350 and P = 0.0373 is 20.413475000000012