In mathematics, trigonometric interpolation is interpolation with trigonometric polynomials. Interpolation is the process of finding a function which goes through some given data points. For trigonometric interpolation, this function has to be a trigonometric polynomial, that is, a sum of sines and cosines of given periods. This form is especially suited for interpolation of periodic functions.
An important special case is when the given data points are equally spaced, in which case the solution is given by the discrete Fourier transform.
A trigonometric polynomial of degree K has the formThis expression contains 2K + 1 coefficients, a0, a1, … aK, b1, …, bK, and we wish to compute those coefficients so that the function passes through N points:
p(xn)=yn, n=0,\ldots,N-1.
0\leqx0<x1<x2<\ldots<xN-1<2\pi.
The problem becomes more natural if we formulate it in the complex plane. We can rewrite the formula for a trigonometric polynomial as
p(x)=
K | |
\sum | |
k=-K |
ckeikx,
q(z)=
K | |
\sum | |
k=-K |
ckzk,
q(eix)\triangleqp(x).
For more information on formulation of trigonometric interpolating polynomials in the complex plane, see p. 156 of Interpolation using Fourier Polynomials.
Under the above conditions, there exists a solution to the problem for any given set of data points as long as N, the number of data points, is not larger than the number of coefficients in the polynomial, i.e., N ≤ 2K+1 (a solution may or may not exist if N>2K+1 depending upon the particular set of data points). Moreover, the interpolating polynomial is unique if and only if the number of adjustable coefficients is equal to the number of data points, i.e., N = 2K + 1. In the remainder of this article, we will assume this condition to hold true.
If the number of points N is odd, say N=2K+1, applying the Lagrange formula for polynomial interpolation to the polynomial formulation in the complex plane yields that the solution can be written in the formwhere
tk(x)=
-iKx+iKxk | |
e |
\prod\begin{alignm&=0\\[-4mu]m&\nek\end{align}}2K
| |||||||||||
|
.
-iKx+iKxk | |
e |
eix
eix
tk(xk)=1
tk(x)
eix
tk(x)
If the number of points N is even, say N=2K, applying the Lagrange formula for polynomial interpolation to the polynomial formulation in the complex plane yields that the solution can be written in the formwhereHere, the constants
\alphak
\cos(Kx)
\sin(Kx)
\varphiK
\alphak
tk(x)=
| |||||||||||||||||||
|
.
\alphak=\sum\begin{alignm&=0\\[-4mu]m&\nek\end{align}}2K-1xm-2\varphiK
tk(x)=
\sin\tfrac12(x-\alphak) | |
\sin\tfrac12(xk-\alphak) |
\prod\begin{alignm&=0\\[-4mu]m&\nek\end{align}}2K-1
\sin\tfrac12(x-xm) | |
\sin\tfrac12(xk-xm) |
.
Note that care must be taken in order to avoid infinities caused by zeros in the denominators.
Further simplification of the problem is possible if nodes
xm
x | ||||
|
,
Further simplification by using would be an obvious approach, but is obviously involved. A much simpler approach is to consider the Dirichlet kernel
D(x,N)= | 1 | + |
N |
2 | |
N |
(N-1)/2 | |
\sum | |
k=1 |
\cos(kx)=
\sin\tfrac12Nx | |
N\sin\tfrac12x |
,
N>0
D(x,N)
eix
D(xm,N)=\begin{cases}0form ≠ 0\\1form=0\end{cases}.
tk(x)
\begin{align} tk(x)&=D(x-xk,N)=\begin{cases} \dfrac{\sin\tfrac12N(x-xk)}{N\sin\tfrac12(x-xk)}forx ≠ xk\\[10mu] \lim\limitsx\to\dfrac{\sin\tfrac12Nx}{N\sin\tfrac12x}=1forx=xk \end{cases}\\&=
sinc\tfrac12N(x-xk) | |
sinc\tfrac12(x-xk) |
. \end{align}
sincx= | \sinx |
x |
.
For
N
D(x,N)= | 1 | + |
N |
1 | |
N |
\cos\tfrac12Nx+
2 | |
N |
(N-1)/2 | |
\sum | |
k=1 |
\cos(kx)=
\sin\tfrac12Nx | |
N\tan\tfrac12x |
.
D(x,N)
eix
\sin\tfrac12Nx
D(xm,N)=\begin{cases}0form ≠ 0\\1form=0\end{cases}.
tk(x)
\begin{align} tk(x)&=D(x-xk,N)=\begin{cases} \dfrac{\sin\tfrac12N(x-xk)}{N\tan\tfrac12(x-xk)}forx ≠ xk\\[10mu] \lim\limitsx\to\dfrac{\sin\tfrac12Nx}{N\tan\tfrac12x}=1forx=xk. \end{cases}\\&=
sinc\tfrac12N(x-xk) | |
sinc\tfrac12(x-xk) |
\cos\tfrac12(x-xk) \end{align}
tk(x)
\sin\tfrac12Nx
\sin\tfrac12Nx
xm
A MATLAB implementation of the above can be found here and is given by:
function tau = trigcardinal(x,N)ws = warning('off','MATLAB:divideByZero');% Form is different for even and odd N.if rem(N,2)
0) = 1; % fix value at x=0
The special case in which the points xn are equally spaced is especially important. In this case, we have
xn=2\pi
n | |
N |
, 0\leqn<N.
The transformation that maps the data points yn to the coefficients ak, bk is obtained from the discrete Fourier transform (DFT) of order N.
Yk=
N-1 | |
\sum | |
n=0 |
yn e-i
yn=p(xn)=
1 | |
N |
N-1 | |
\sum | |
k=0 |
Yk ei
(Because of the way the problem was formulated above, we have restricted ourselves to odd numbers of points. This is not strictly necessary; for even numbers of points, one includes another cosine term corresponding to the Nyquist frequency.)
The case of the cosine-only interpolation for equally spaced points, corresponding to a trigonometric interpolation when the points have even symmetry, was treated by Alexis Clairaut in 1754. In this case the solution is equivalent to a discrete cosine transform. The sine-only expansion for equally spaced points, corresponding to odd symmetry, was solved by Joseph Louis Lagrange in 1762, for which the solution is a discrete sine transform. The full cosine and sine interpolating polynomial, which gives rise to the DFT, was solved by Carl Friedrich Gauss in unpublished work around 1805, at which point he also derived a fast Fourier transform algorithm to evaluate it rapidly. Clairaut, Lagrange, and Gauss were all concerned with studying the problem of inferring the orbit of planets, asteroids, etc., from a finite set of observation points; since the orbits are periodic, a trigonometric interpolation was a natural choice. See also Heideman et al. (1984).
Chebfun, a fully integrated software system written in MATLAB for computing with functions, uses trigonometric interpolation and Fourier expansions for computing with periodic functions. Many algorithms related to trigonometric interpolation are readily available in Chebfun; several examples are available here.