4

I have been trying to implement these two filters in MATLAB:

Daubechies 4 undecimated wavelet 3.75 Hz e wavelet 7.5Hz Daubechies 4 undecimated filter bank 7.5 Hz

I have massively researched the wavelet toolbox and I still can't figure out what is the correct implementation of the algorithm, as well as the definition of the cut-off frequencies.

Does someone have experience with this?

What I tried was:

movementOut = movementIn;
% Set Daubechies wavelet name.
wname = strcat('db',num2str(order));
% Compute the corresponding scaling filter.
daubechies=dbwavf(wname);
movementOut = filter(daubechies,1,coordinates_values);
%movementOut = filtfilt(daubechies,1,coordinates_values);

I tried both filter and filtfilt but the output result seems pretty much similar. I am processing Kinect Z data (varying from 4.5m to 1.0m and then again to 4.5m) but I don't seem to see any difference using wavelets. In state-of-art approaches, the db4 wavelets are being often used.

Doubts:

  1. is this implementation correct?

  2. how can I set the cut-off frequency?

  3. how to implement the filter bank?

Thanks in advance.

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
16per9
  • 502
  • 4
  • 17
  • Without any background it is quite difficult to understand what exactly you are trying to do. Is it true that you want to low pass filter the signal? Why do you want to apply wavelets? What is the sampling rate of the signal? Are you aiming for a real time application of the filter? Did you try simpler filter designs, such as butterworth? – Diphtong Nov 29 '16 at 16:24
  • @Diphtong yes, I want to low pass filter with db4 with a defined cut-off frequency. I want to apply wavelets because I want to replicate a state-of-art work made by specific authors. My fs = 200 Hz. Filter to be used in pos -processing. I already implemented butterworth filters and they work fine. I just can fine a proper solution to the implementation of db4 with cut-off frequencies. – 16per9 Nov 29 '16 at 16:30
  • While I cannot answer your question, I can provide some advice: Filtfilt is most likely not a good idea. Furthermore, if you want to implement this wavelet filter, you need to get a good book on wavelets and start from the basics. This is not about implementation but about basic understanding (which I also dont have). The topic looks rather difficult to me. It will likely cost you more than a month. At last you should remember that in a digital filter the cut-off frequency depends on the sampling frequency. You should rather express the cut-off frequency as a fraction of the Nyquist frequency. – Diphtong Nov 29 '16 at 17:16
  • @Diphtong yeah that's the basics of filter/filtfilt for the use of butterworth filter. you calculate the ratios based on those frequencies and its pretty much simple to go with the implementation. But for some reason, the daubechies implementation with the added cut-off frequency doesnt seem to exist (I cant find any example with a regular and validated implementation) – 16per9 Nov 30 '16 at 16:04

1 Answers1

0

It's not super clear to me what you want to do but you need to use wavelet filters in wavelet algorithms. Do you have the wavelet toolbox? It has good documentation!

Wavelet transforms do band-pass filtering, so you may want to use another algorithm for your purpose. To see what would be 3.75 Hz or 7.50 Hz in your signal, you can compute the upper and lower bounds, if you know the sampling rate of your input.

Have a look at this post, which provides some links to matlab scripts for fast wavelet transforms (a sequence of filtering and up-/downsampling combinations) you can use if you don't have the wavelet toolbox.

Mind you, the fast wavelet transform does use downsampling so it is not 'undecimated'. There are a number of ways to do that, in the wavelet toolbox, in WaveLab and other places (see this paper for an overview). Some more reading may be a good idea, the references in that paper should do the trick.

One final warning: the name db4 is sometimes used for the filters with 4 coefficients (2 vanishing moments), and sometimes for the filters with 4 vanishing moments (8 coefficients)! Google "Daubechies 4" and you'll find both.

alle_meije
  • 2,424
  • 1
  • 19
  • 40