haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
6.04k stars 1.13k forks source link

How to get coefficients for Wavelet constructor? #415

Closed aspecialkey closed 5 years ago

aspecialkey commented 5 years ago

Hello,

I have some signal data and want to transform it with discrete wavelet transformation. Therfore I have found your wavelet.java and want to use it, but I don`t know which coefficients I have to pass to the constructor or how to calculate them.

It would be great if you can give me a hint!

Best regards

public Wavelet(double[] coefficients) {
        ncof = coefficients.length;

        ioff = joff = -(ncof >> 1);

        cc = coefficients;

        double sig = -1.0;
        cr = new double[ncof];
        for (int i = 0; i < ncof; i++) {
            cr[ncof - 1 - i] = sig * cc[i];
            sig = -sig;
        }
}
haifengl commented 5 years ago

Wavelet is a parent class. You should use one of child classes such as DaubechiesWavelet, SymletWavelet, etc. You may also want to check out WaveletShrinkage, which denoise a signal with wavelet.