Volume 9, Issue 4
Tricks of the Trade
In and Out
Download This Issue
Staff and Contributors
Tricks of the Trade
Interpolation with Noise
Vittorio G. Caffa
In "Interpolation," TMJ, 9(2), 2004, pp. 306-310, a method was presented for computing derivatives of a sampled function. This method only works if the data is unaffected by measuring error. If models of the data source and the measurement noise are available, you can use (for example) Kalman filtering techniques for computing an optimal estimation (see mathworld.wolfram.com/KalmanFilter.html). Alternatively, you can achieve good results using a simple filtering technique.
Consider again the exact function .
Take from a uniform random distribution over the interval , and append the endpoints.
Now sample over the interval adding Gaussian noise corresponding to measurement error.
Superimpose the sampled data over a plot of its interpolated function to visualize the data. It is clear that the interpolation is not smooth, so computing derivatives will be problematic.
A simple filtering technique involves computing a truncated Fourier series of the function , that is,
Requiring the wavelength to satisfy avoids wrap-around effects. As only the frequencies up to are considered, the method acts like a low-pass filter. The value of the parameter should be tuned to obtain the best results. This approach should be compared with that used in "Spectral Analysis of Irregularly Sampled Data," TMJ, 7(1), 1997, pp. 27-28.
Here is the Fourier basis set for arbitrary and .
The best truncated Fourier expansion, , for and is computed using Fit.
Here is the sampled data superimposed over a plot of .
Compare the first derivatives; the red curve denotes the exact value , the green curve denotes the interpolated function , and the blue curve denotes the truncated Fourier fit . The agreement between the exact function and the truncated Fourier fit is excellent.
About Mathematica | Download Mathematica Player
© Wolfram Media, Inc. All rights reserved.