MATLAB Answers

Advantages of using the new CWT interface over the old CWT interface.

19 ビュー (過去 30 日間)
I see that there are two different versions of CWT function in R2018b and Mathworks recommends using the newer interface for the function.
What are the advantages of the newer interface over the old one?
Newer version:
Older version:

採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 2 月 21 日
In the newer version you can optionally specify what frequency or period ranges they are interested in. Thinking in terms of periods or frequencies is much more natural for applications than in terms of scales, which are unitless. You are encouraged to look at CWTFILTERBANK for example. As an example of the difficulty in specifying scales, you are using linearly spaced scales in your CWT example. For the CWT, we should prefer logarithmically spaced scales.
Another advantage is that the new CWT uses L1 normalization as opposed to the L2 normalization used in the legacy CWT, The L1 normalization is better for time frequency analysis because it more faithfully represents the magnitude of the components, whereas the L2 normalization is a bandpass filter that has a sqrt(s) term as a multiplier where s is the scale. So as the scale gets bigger, or equivalently as the
frequency becomes lower the wavelet transform is multiplying the frequency content of the signal by a factor of sqrt(s). We find that to be undesirable because it misrepresents the amplitudes.
For example, consider this:
%%New CWT
Fs = 1e3;
t = 0:1/Fs:2;
x = cos(2*pi*32*t).*(t>=0.1 & t <= 0.7)+cos(2*pi*64*t).*(t >= 0.8);
wgnNoise = 0.05*randn(size(t));
x = x+wgnNoise;
cwt(x,1000,'amor','voices',12)
title('New CWT');
%%Old CWT
%
a0 = 2^(1/12);
scales = 2*a0.^(0:8*12);
figure;
[cfs_old,f_old] = cwt(x,scales,'morl','plot',0.001);
colorbar;
The amplitudes of the 32 and 64 Hz sinusoids is 1. BOTH have amplitude 1.
If you look at the new CWT, you see that clearly, it gets it right. Both sine waves are shown to have amplitude 1. Compare that against the legacy CWT, the plot is much more difficult to interpret. Not only that, we have no way of relating the magnitude, or magnitude squared of the wavelet coefficients to the actual signal values. Also, note the new CWT shows clearly the cone of influence where edge effects become significant. The old CWT does not give you this information.
Even if we plot the old CWT as a function of frequency:
surf(t,f_old,abs(cfs_old),'edgecolor','none'); view(0,90); colorbar; axis tight;
The new CWT looks much nicer in terms of representing the time-localized components of constant magnitude.
It is strongly recommended that you use the new interface for the CWT function.

  0 件のコメント

Sign in to comment.

その他の回答 (0 件)

タグ

タグが未入力です。

製品


リリース

R2018b

Translated by