Interpolation: Difference between revisions
Scott Munro (talk | contribs) m (1 revision imported) |
imported>Scott.Munro |
||
Line 5: | Line 5: | ||
== Model theory == | == Model theory == | ||
{{ | [[File:Interpolation2.png|thumb|400px|Figure 1. An example of cubic spline interpolation with linear extrapolation at the extents.]] | ||
=== Linear interpolation === | |||
Linear interpolation is a technique for approximating the value of a function between two known data points. It involves constructing a straight line that passes through the two given points and using this line to estimate the value of the function at an intermediate point. | |||
Given two data points <math>(x_1, y_1)</math> and <math>(x_2, y_2)</math>, where <math>x_1 < x_2</math>, the linear interpolation formula to estimate the value <math>y</math> at a point <math>x</math> within the interval <math>(x_1, x_2)</math> is: | |||
:<math>y = y_1 + \frac{x - x_1}{x_2 - x_1} (y_2 - y_1)</math> | |||
Linear interpolation provides a simple and computationally efficient method for approximating function values. | |||
=== Cubic spline interpolation === | |||
Cubic spline interpolation uses a piecewise cubic polynomial to approximate a function smoothly between known data points. | |||
Given a set of distinct data points <math>(x_1, y_1), (x_2, y_2), \dots, (x_n, y_n)</math>, where <math>x_1<x_2< \dots < x_n</math>, a cubic spline interpolator constructs a piecewise cubic polynomial <math>S(x)</math> that satisfies the following conditions: | |||
# Interpolation: <math>S(x_i) = y_i</math> for <math>i=1,2,\dots,n</math>. (The spline passes through all data points.) | |||
# Smoothness: <math>S(x)</math> and its first two derivatives are continuous across the entire interval <math>[x_1, x_n]</math>. (The spline has no abrupt changes in its slope or curvature.) | |||
Cubic splines offer enhanced accuracy and flexibility compared to linear interpolation, especially for functions with nonlinear behavior. | |||
This implementation of cubic spines also applies linear extrapolation at the extents of the data set, as illustrated in Figure 1. | |||
Please see the Wikipedia article on [[wikipedia:Spline interpolation|Spline interpolation]] or references such as Napier-Munn et al. (1996) for a more detailed description of cubic spline interpolation.{{Napier-Munn et al. (1996)}} | |||
== Excel == | == Excel == |
Revision as of 01:14, 13 January 2024
Description
This article describes linear and cubic spline data interpolation methods.
Model theory
Linear interpolation
Linear interpolation is a technique for approximating the value of a function between two known data points. It involves constructing a straight line that passes through the two given points and using this line to estimate the value of the function at an intermediate point.
Given two data points and , where , the linear interpolation formula to estimate the value at a point within the interval is:
Linear interpolation provides a simple and computationally efficient method for approximating function values.
Cubic spline interpolation
Cubic spline interpolation uses a piecewise cubic polynomial to approximate a function smoothly between known data points.
Given a set of distinct data points , where , a cubic spline interpolator constructs a piecewise cubic polynomial that satisfies the following conditions:
- Interpolation: for . (The spline passes through all data points.)
- Smoothness: and its first two derivatives are continuous across the entire interval . (The spline has no abrupt changes in its slope or curvature.)
Cubic splines offer enhanced accuracy and flexibility compared to linear interpolation, especially for functions with nonlinear behavior.
This implementation of cubic spines also applies linear extrapolation at the extents of the data set, as illustrated in Figure 1.
Please see the Wikipedia article on Spline interpolation or references such as Napier-Munn et al. (1996) for a more detailed description of cubic spline interpolation.[1]
Excel
The interpolation methods may be invoked from the Excel formula bar with the following function calls:
=mdInterp_Linear(known_xs as Range, known_ys as Range, xs as Range)
and
=mdInterp_CubicSpline(known_xs as Range, known_ys as Range, xs as Range)
Invoking the function with no arguments will print Help text associated with the model, including a link to this page.
The input parameters and calculation results are defined below in matrix notation, along with an example image showing the selection of the same cells and arrays in the Excel interface:
|
|
References
- ↑ Napier-Munn, T.J., Morrell, S., Morrison, R.D. and Kojovic, T., 1996. Mineral comminution circuits: their operation and optimisation. Julius Kruttschnitt Mineral Research Centre, Indooroopilly, QLD.