The difference between the old version and new version of CWT (Continuous Wavelet Transform)
18 views (last 30 days)
My name is Supatat Hovanotayan. I am a master student studying in Mechanical Engineering, The University of Tokyo.
The reason why I am writing this question is to ask and consult you about the old version and new version of cwt code.
However, for my research, I have used old and new version of cwt code both to detect abrupt change in roll angular velocity of rail vehicle.
** I am using MATLAB2019a**
This is roll angular velocity signal as shown below
The figure shown below is the result when I used the old version of cwt
And the result when I used the new version of cwt
According to the results, they are totally diferrent, you can see that the result of the old version of cwt shows the maximum wavelet coefficientn the low frequency range[around 1Hz].
But the result of the new version of cwt showa the maximum wavelet coefficient at the around 10Hz.
It makes me confused with it. First of all, I though the result should be like the old version, but once the used the new version of cwt I got the diffrent result.
Therefore, this is my quesion
- What is the diferrece between the old and new version? [I read realease notebook already but do not understand clearly]
- Do you think which result is correct?
- Why did I get different results?
Could anyone please help me to find out this problem it is very impoetant to my master thesis
Thank you very much for your help in advance
I am looking forward to hearing from you
Wayne King on 5 Aug 2019
Hi Supatat, Some of this has been discussed here:
You did not show the code that you used in both cases (old CWT api and new CWT api), but obviously we recommend the new API for a number of reasons.
In your specific case, if you are actually looking at the where the maximum values occur in the wavelet transform, then the old version is not recommend because it normalizes the wavelets using L2 normalization. That is discussed here:
See L1 norm for CWT https://www.mathworks.com/help/wavelet/ref/cwt.html
In your case this means that the bandpass filter used has a peak amplitude that depends on the scale, the lower the scale the higher the amplitude. So it biases the results toward larger scales (or lower frequencies). The new CWT does not do that, all filters have the same magnitude in L1 normalization, that is a fairer picture. That is particularly true if you are looking at values. Qualitatively, it looks like the picture of the signal is the same in both othe old and new CWT, but the L2 normalization of the old API is biasing the results toward lower frequencies.
For example: Here we have two oscillations with unambigously unit amplitude. See that the new CWT gets it right.
Fs = 1e3;
t = 0:1/Fs:1;
x = cos(2*pi*32*t).*(t>=0.1 & t<0.3)+sin(2*pi*64*t).*(t>0.7);
Try the above example with the old CWT and you will see that the reported amplitude (magnitude) for the 32-Hz component is larger than the 64-Hz component and neither of them will be close to 1.
Hope that helps,
More Answers (2)
since I have just started learning of wavelet transfrom .
could you please explain, how to decide scale for cwt (if we are using older cwt)?
what is the significance of scale.