Trigonometric Fitting and Interpolation

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

Trigonometric functions might be the best choice for fitting or interpolating periodic data. If the highest order (period) of the trigonometric function is less than 10, then the least-squares fit to the 10 points is shown. If the order is 10, then the interpolating trigonometric function is plotted. The values of the 10 data points are controlled by the 10 sliders. The checkbox adds a polynomial interpolation to the plot for comparison.

Contributed by: Bruce Atwood and Rikley Buckingham (June 2017)
(Beloit College)
Open content licensed under CC BY-NC-SA



Because of the orthogonality of trigonometric functions, coefficients obtained from the discrete Fourier transform give the proper weights for both least-squares fitting and interpolation. From [1], if is the order of the trigonometric polynomial and is the number of data points, then

is the least-squares fit of the data if and the interpolating function if . In this equation, is the discrete Fourier transform of the data.


[1] T. Sauer, Numerical Analysis, 2nd ed., Boston: Pearson, 2012.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.