Declaration: KFilterSpectrum(var Spectrum: TDoubleArray; FilterKernel: TDoubleArray): integer;
Applies a spectral filter to the signal stored in the array 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 applying the functions CalcSincLPKernel and CalcSincHPKernel.

Please note that this moving kernel filter creates possibly unwanted edge effects at both ends of the spectral range. In order to minimize this effect you should consider to use the function KFilterSpectrumEdgeSpecial.

The function returns the following error codes:

 0 ... everything is OK
-1 ... FilterKernel is larger than the spectral range

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 to avoid minute shifts of the filtered spectral signal.