KFilterSpectrumEdgeSpecial

Declaration: KFilterSpectrumEdgeSpecial(var Spectrum: TDoubleArray; ExtPolOrder: integer; FilterKernel: TDoubleArray): integer;
Kernel based filters as implemented by the function KFilterSpectrum exhibit the drawback of creating edge effects at the end of the filtering range (due to a decreasing number of data points when the moving kernel approaches the edge). The function KFilterSpectraEdgeSpecial tries to minimize this effect by extrapolating the data at the edges using a polynomial of order ExtPolOrder (valid range: 1 to 4).

The spectral filter is applied to the signal contained in the variable parameter Spectrum. The filter function is controlled by the coefficients stored in the array parameter FilterKernel. The filter coefficients for a weighted sinc lowpass/highpass filter can be calculated by means of the functions CalcSincLPKernel and CalcSincHPKernel.

The function returns the following error codes:

 0 ... everything is OK
-1 ... FilterKernel is larger than the spectral range
-2 ... invalid PolyOrder (1..4 are valid)

Hint: Although this type of filter can be used with any number of filter kernel coefficients, it is strongly recommended to use only filter kernels with an odd number of coefficients in order to avoid minute shifts of the filtered spectral signal.


Last Update: 2018-Apr-12