With CWT it's clear enough. We have function of two variables which are scale and translation. But what about DWT?

Here is Matlab code:

x = 0:pi/100:3*pi;
y = sin(x);
[lHaar, hHaar] = dwt(y, 'haar'); 
[lSym, hSym] = dwt(y, 'sym4');

And then I plot them.

Original signal:


Haar transform with original signal: Haar

And symlet transform: Symlet

And how can I get time-frequency domain from the results? Where are scales and time?

How can I plot nice images like this one?


  • $\begingroup$ This question seems better suited for electronics.stackexchange or dsp.stackexchange. $\endgroup$ – Math1000 Apr 29 '16 at 14:20

I have not used Matlab's DWT functions too much as I mostly build my own functions, but in general the most commonly used DWTs are dyadic, which means they subsample a factor of two for each scale. So you will get discrete "frequencies" : one frequency which is double, one which is x4 one which is x8 and so on. Each time the number of samples will be halved. So say you do a 3 level dwt of a 128 sample signal

  • 1st level: low pass will get 64 samples, high pass 64 samples (what I suspect you are looking at)
  • 2nd level: low pass on the 64 previously low passed will get 32 low pass, and 32 high pass
  • 3rd level: low pass on the 32 previously low passed will get 16 low, pass and 16 high pass

So the result is split into 4 frequency bands: 16,16,32,64 samples. The ones with fewest samples will be containing the "coarsest" details or lowest frequencies.

You can type "help dwt" to see exactly what it does, my suspicion is that it does one level and that you have to call it again with the low frequency one to get second level and so on.

  • $\begingroup$ " one frequency which is double, one which is x4 one which is x8 and so on" but I can't get the actual frequency? Only that relative representation? $\endgroup$ – Long Smith Apr 29 '16 at 16:00
  • $\begingroup$ If you do an FFT on the filters themselves you will get the Fourier frequencies they contain / detect, but the discrete wavelet transform only has these discrete steps of frequencies. The wavelet transforms have worse precision in frequency but higher precision in localization compared to the FFT. $\endgroup$ – mathreadler Apr 29 '16 at 16:29
  • $\begingroup$ Yes, yes. I know it I just thought that wavelets can almost fully replace FFT and bring in a gift flexible scaling. Thanks a lot. $\endgroup$ – Long Smith Apr 29 '16 at 16:34
  • 1
    $\begingroup$ If you want more flexible scaling (or rather more localization for each scale) you can take a look at the "undecimated wavelet transform". It is the same as the DWT but without the downsampling each scale. Or you can take a look at "wavelet packet analysis" where you can choose which channel to keep going on (not only iterate on the low pass all the time but sometimes the high-pass channel). If you are curious you can also take a look at the Shannon Wavelet, it is very related to the FFT in some ways which you will recognize if you have studied signal processing before. $\endgroup$ – mathreadler Apr 29 '16 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.