Whittaker |
It minimizes sum(f - y)^2 + sum(lambda* f'(p)) where y are the data, f are the smoothed data, and f'(p) is the p-th derivative of the smoothed function evaluated numerically. In other words, the filter imposes a penalty on the p-th derivative of the data, which is taken as a measure of non-smoothness. Smoothing increases with increasing value of lambda. The current implementation works up to p = 5; usually one should use p = 2 or 3. For points far from the boundaries of the data series, the frequency response of the smoother is given by 1/(1+lambda* (2-2* cos(omega))^2p); where n is the order of the penalized derivative and omega = 2 * pi * f / fs, with fs being the sampling frequency (reciprocal of the distance between the data points). Note that strong smoothing leads to numerical noise (which is smoothed similarly to the input data, thus not obvious in the output). For lambda = 1e9, the noise is about 1e-6 times the magnitude of the data. Since higher p values require a higher value of lambda for the same extent of smoothing (the same bandwidth), numerical noise is increasingly bothersome for large p, but not for p <= 2.
public class WhittakerHendersonSmoother
The WhittakerHendersonSmoother type exposes the following members.
| Name | Description | |
|---|---|---|
| WhittakerHendersonSmoother | Creates a WhittakerHendersonSmoother for data of a given length and with a given penalty order and smoothing parameter lambda. This constructor is useful for repeated smoothing operations with the same parameters and data sets of the same length. Otherwise, the static Smooth(Double, Int32, Double) method is more convenient. |
| Name | Description | |
|---|---|---|
| BandwidthToLambda | Calculates the smoothing parameter lambda for a given penalty derivative order and desired bandwidth (the frequency where the response decreases to -3 dB, i.e. 1/sqrt(2)). This bandwidth is valid for points far from the boundaries of the data. | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
| NoiseGainToLambda | Calculates an approximation of the smoothing parameter lambda for a given white-noise gain. This is valid for points far from the boundaries of the data; the noise gain is much higher near the boundaries. | |
| SavitzkyGolayBandwidth | Calculates the bandwidth of a traditional Savitzky-Golay (SG) filter. | |
| Smooth(Double, Double) | Smooths the data with the parameters passed to the constructor. | |
| Smooth(Double, Int32, Double) | Smooths the data with the given penalty order and smoothing parameter lambda. When smoothing multiple data sets with the same length, using the constructor and then Smooth(Double, Double) will be more efficient. | |
| SmoothLikeSavitzkyGolay | Smooths the data in a way comparable to a traditional Savitzky-Golay filter with the given parameters degree and m. | |
| ToString | Returns a string that represents the current object. (Inherited from Object) |
Implementation notes: Storage of symmetric or triangular band-diagonal matrices: For a symmetric band-diagonal matrix with bandwidth 2 m - 1 we store only the lower right side in b: b(0, i) are diagonal elements a(i, i) b(1, i) are elements a(i+1, i) ... b(m-1, i) are bottommost (leftmost) elements a(i+m-1, i) where i runs from 0 to n-1 for b(0, i) and 0 to n - m for the further elements at a distance of m from the diagonal. A lower triangular band matrix is stored exactly the same way.