15
$\begingroup$

I am having trouble understanding on how to read the plot plotted by a wavelet transform,

here is my simple Matlab code,

load noissin;
% c is a 48-by-1000 matrix, each row 
% of which corresponds to a single scale.
c = cwt(noissin,1:48,'db4','plot');

enter image description here

So the brightest part means the scaling coffiecient size is bigger, but how exactly i can understand this plot what is happening there ? Kindly help me.

$\endgroup$
1
  • $\begingroup$ i attempted following code in matlab t=0:0.001:2; y=sin (2*pi*20*t) wname='cmor0.5-1' scale=1:0.1:80; cwt(y,scale,wname,'plot'); i got following plot !enter image description here real and imaginary parts showing gaps which are observed in CWT with morl wavelet. So in a way CWT with complex morlet wavelet too contains phase information. How to explain that ?? $\endgroup$
    – user13564
    Jan 30, 2015 at 7:05

3 Answers 3

15
$\begingroup$

Imagine for one second, that you just plotted your daubechies-4 wavelet, as you can see here in red.

enter image description here

Now imagine that you take this waveform in red, and simply do a cross-correlation with your signal. You plot that result. This will be the first row of your plot. This is scale-1. Next, you dilate your Daubechies-4 wavelet, (that is, you simply make it 'stretch' it in time, by some factor). Then, you again do a cross-correlation of this new waveform with your signal. You then get row two of your plot. This is scale-2. You keep doing this for all scales, which means you keep taking your original 'mother' wavelet, and you keep dilating, then cross-correlating, dilating, and cross-correlating, etc, and you just plot the results one on top of the others.

This is what the CWT plot is showing you. The results of performing a cross-correlation of your signal with a wavelet at different scales, that is, at different dilation (stretch) factors.

So let us interpret your image. In the first row, you can see that you have weak amplitudes in your cross-correlation. That means that it is telling you, almost nothing in your signal correlates, (or 'matches') your wavelet, when it is at scale-1, (when it is at the smallest scale). You keep stretching your wavelet and correlating, and still it is not matching anything in your signal, until you reach say, scale-31. So when you stretch your wavelet 31 times, and performed a cross-correlation, you start to see some bright spots, which means you are getting good cross-correlation scores between your stretched wavelet, and your signal.

If you look however at the very top, we have the brightest spots. So for scale-46, you made that row by stretching your original wavelet 46 times, and then cross-correlated it with your signal, and then that is your row-46. So you see a lot of nice bright spots. You can see that at positions (x-axis) ~25, ~190, and ~610, I have bright spots. So that is telling you, you have some feature in your signal, that very closely matches your wavelet that is stretched 46 times. So you have 'something' at those locations that closely match your wavelet at this scale.

(Of course, in your case, you have used noise, so the positions that I have talked about are random - that is, there is nothing really 'interesting' going on. Do a CWT with a sine pulse and what I am saying can be made clearer to you.)

In summary, the CWT is simply showing you all possible correlation scores between your template/matched filter (in this case daub-4 wavelet), at different positions, (x-axis) , also at different stretched factors, (y-axis).

Hope this helped.

$\endgroup$
8
  • $\begingroup$ Thank you very much , this really helped, but how could you say that i have found out the frequency and time of my signal by this process? $\endgroup$ Feb 20, 2013 at 16:30
  • 2
    $\begingroup$ @Effected You found the 'time' of occurance of some feature in your signal, by where you get maximum correlation scores. (Example, ~25, ~190, ~610) in your example. To get the frequency content of your signal at that point, you can just look at the FFT of that portion of your signal, OR, you can look at the FFT of your wavelet at that scale, and look at its frequency response. $\endgroup$
    – Spacey
    Feb 20, 2013 at 16:33
  • $\begingroup$ So, do we suppose to take DCT after wavelet in order to have both time and frequency components ? If i have a sine wave (x-axis = time , y-axis = amplitude) and if i take its FFT then i have frequency components from the fft and time components from the original signal then why do we suppose to use wavelet ? $\endgroup$ Feb 20, 2013 at 16:36
  • 1
    $\begingroup$ @Effected The reason you use DFT/DCT, is to get global frequency content. DFT/DCT tells your frequency content for the entire signal. Where is one specific frequency in time? You dont know. However if you use wavelets, then you can find out not only what your frequency is, (similar to DFT/DCT), but also where you have that frequency. (Location in time). $\endgroup$
    – Spacey
    Feb 20, 2013 at 16:44
  • $\begingroup$ For the record, frequency only exists as a global concept. As soon as you start trying to pin frequency down to a time period, you are really talking about a frequency distributions. The distribution narrows as the time span or scale increases. Computing the DFT of wavelets of differing scales will give you an idea how to interpret associated transform results back to the frequency domain; think bandpass filter. The Morlet wavelet happens to have a nicely Gaussian frequency distribution that is well suited for relating back to Fourier concepts. @endolith touched on this in his response. $\endgroup$
    – user2718
    Feb 20, 2013 at 22:19
12
$\begingroup$

These plots were helpful for me to understand, coming from a STFT background:

The complex Morlet (sinusoidal) wavelet looks and behaves like the complex kernel of a STFT (since it's derived from the Gabor transform, a type of STFT). When you "slide it past" a signal of the same frequency, it matches, no matter the phase of the signal you're measuring, producing a magnitude and phase measurement at each point (and this is a plot of the magnitude alone):

Magnitude of complex Morlet wavelet transform

Magnitude plot of complex Morlet wavelet transform

The real-valued Morlet wavelet only matches when the phases of the wavelet and the signal line up. So as you slide it past the signal you're measuring, it goes in and out of phase, producing maxima and minima as they cancel or reinforce:

Magnitude of continuous real Morlet wavelet transform

Magnitude of continuous real Morlet wavelet transform

(Actually, in that case, we're plotting the magnitude, so both the positive and negative matches produce orange dots. It's better to switch to a bipolar colormap instead, to show that some peaks are in phase and others are out of phase):

Continuous real Morlet wavelet transform using bipolar colormap

Continuous real Morlet wavelet transform using bipolar colormap

With the real-valued Morlet, the magnitude and phase information are combined into a single output value.

Most commonly-used wavelets are real-valued, so they only match up when the wave you're measuring and the wave you're testing with line up, leading to these oscillations or ripples in the scalogram as you slide one past the other.

$\endgroup$
4
  • $\begingroup$ Where did you get those plots from, btw? $\endgroup$
    – Spacey
    Feb 23, 2013 at 23:14
  • $\begingroup$ @Mohammad: Oh, if you follow the links I have more information about them, but in short, I made them with this code: phy.uct.ac.za/courses/python/examples/… $\endgroup$
    – endolith
    Feb 24, 2013 at 20:56
  • $\begingroup$ Link is dead, now they're at github.com/emanuele/cwt or gist.github.com/endolith/2783866 $\endgroup$
    – endolith
    Oct 8, 2016 at 4:11
  • 1
    $\begingroup$ Very nice! I decided to learn about wavelets, googled, and within five minutes I'm funneled back into the stackexchange ecosystem to a well written "aha!"-class answer. This is a well-chosen, minimal set of images. Thank you! $\endgroup$
    – uhoh
    Feb 12, 2017 at 10:34
5
$\begingroup$

This is the example that i think is the best to understand Wavelet plot.

Have a look at the image below, The Waveform (A) is our original Signal, Waveform (B) shows a Daubechies 20 (Db20) wavelet about 1/8 second long that starts at the beginning (t = 0) and effectively ends well before 1/4 second. The zero values are extended to the full 1 second. The point-by-point comparison* with our pulse signal (A) will be very poor and we will obtain a very small correlation value.

we first shift the unstretched basic or mother wavelet slightly to the right and perform another comparison of the signal with this new waveform to get another correlation value. We continue to shift and when the Db20 wavelet is in the position shown in (C) we get a little better comparison than with (B), but still very poor because (C) and (A) are different frequencies.

After we have continued shifting the wavelet all the way to the end of the 1 second time interval, we start over with a slightly stretched wavelet at the beginning and repeatedly shift to the right to obtain another full set of these correlation values. Waveform (D) shows the Db20 wavelet stretched to where the frequency is roughly the same as the pulse (A) and shifted to the right until the peaks and valleys line up fairly well. At these particular amounts of shifting and stretching we should obtain a very good comparison and a large correlation value. Further shifting to the right, however, even at this same stretching will yield increasingly poor correlations. Further stretching doesn't help at all because even when lined up, the pulse and the over-stretched wavelet won’t be the same frequency.

enter image description here

In the CWT we have one correlation value for every shift of every stretched wavelet.† To show the correlation values (quality of the “match”) for all these stretches and shifts, we use a 3-D display.

Here it goes,

enter image description here

The bright spots indicate where the peaks and valleys of the stretched and shifted wavelet align best with the peaks and valleys of the embedded pulse (dark when no alignment, dimmer where only some peaks and valleys line up, but brightest where all the peaks and valleys align). In this simple example, stretching the wavelet by a factor of 2 from 40 to 20 Hz (stretching the filter from the original 20 points to 40 points) and shifting it 3/8 second in time gave the best correlation and agrees with what we knew a priori or “up front” about the pulse (pulse centered at 3/8 second, pulse frequency 20 Hz).

We chose the Db20 wavelet because it looks a little like the pulse signal. If we didn’t know a priori what the event looked like we could try several wavelets (easily switched in software) to see which produced a CWT display with the brightest spots (indicating best correlation). This would tell us something about the shape of the event.

For the simple tutorial example above we could have just visually discerned the location and frequency of the pulse (A). The next example is a little more representative of wavelets in the real world where location and frequency are not visible to the naked eye.

See the example below,

enter image description here

Wavelets can be used to analyze local events. We construct a 300 point slowly varying sine wave signal and add a tiny “glitch” or discontinuity (in slope) at time = 180. We would not notice the glitch unless we were looking at the closeup (b).

Now lets see how FFT will display this Glitch, have a look, enter image description here

The low frequency of the sine wave is easy to notice, but the small glitch cannot be seen.

But if we use CWT instead of FFT it will clearly display that glitch, enter image description here

As you can see CWT wavelet display clearly shows a vertical line at time = 180 and at low scales. (The wavelet has very little stretching at low scales, indicating that the glitch was very short.) The CWT also compares well to the large oscillating sine wave which hides the glitch. At these higher scales the wavelet has been stretched (to a lower frequency) and thus “finds” the peak and the valley of the sine wave to be at time = 75 and 225, For this short discontinuity we used a short 4-point Db4 wavelet (as shown) for best comparison.

$\endgroup$

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