Main Content

频率断裂的连续和离散小波分析

This example shows the difference between the discrete wavelet transform (DWT) and the continuous wavelet transform (CWT).

什么时候持续分析比离散分析更合适?

要回答此问题,请考虑相关问题:您是否需要了解连续分解的所有值以确切地重建信号?你能执行非还原分析吗?当信号的能量是有限的时,不需要分解的所有值来精确地重建原始信号,只要您使用的是满足一些可容许条件的小波。通常的小波满足这种情况。在这种情况下,连续时间信号的特征在于离散变换的知识。在这种情况下,离散分析足够并且连续分析是多余的。

Continuous analysis is often easier to interpret, since its redundancy tends to reinforce the traits and makes all information more visible. This is especially true of very subtle information. Thus, the analysis gains in "readability" and in ease of interpretation what it loses in terms of saving space.

DWT and CWT of a Signal with a Frequency Break

Show how analysis using wavelets can detect the exact instant when a signal changes. Use a discontinuous signal that consists of a slow sine wave abruptly followed by a medium sine wave.

加载freqbrk;signal = freqbrk;

Perform the discrete wavelet transform (DWT) at level 5 using the Haar wavelet.

lev = 5; wname ='db1';nbcol = 64; [c,l] = wavedec(signal,lev,wname);

Expand discrete wavelet coefficients for plot.

len = length(signal); cfd = zeros(lev,len);fork = 1:lev d = detcoef(c,l,k); d = d(:)'; d = d(ones(1,2^k),:); cfd(k,:) = wkeep(d(:)',len);结尾CFD = CFD(:);我=查找(ABS(CFD)'row');h211 = subplot(2,1,1); h211.XTick = []; plot(signal,'r');标题('分析信号。');ax = gca; ax.XLim = [1 length(signal)]; subplot(2,1,2); colormap(cool(128)); image(cfd); tics = 1:lev; labs = int2str(tics'); ax = gca; ax.YTickLabelMode =“手动”;ax.YDir =“正常”;AX.BOX =.'On';ax.YTick = tics; ax.YTickLabel = labs; title('Discrete Transform, absolute coefficients.');ylabel('Level');

Figure contains 2 axes objects. Axes object 1 with title Analyzed signal. contains an object of type line. Axes object 2 with title Discrete Transform, absolute coefficients. contains an object of type image.

Perform the continuous wavelet transform (CWT) and visualize results

figure; [cfs,f] = cwt(signal,1,'waveletparameters',[3 3.1]); hp = pcolor(1:length(signal),f,abs(cfs)); hp.EdgeColor ='没有';套(GCA,'YScale','log');xlabel('Sample');ylabel('log10(f)');

图包含轴对象。The axes object contains an object of type surface.

If you just look at the finest scale CWT coefficients, you can localize the frequency change precisely.

plot(abs(cfs(1,:))); grid;

图包含轴对象。轴对象包含类型线的对象。

This example shows an important advantage of wavelet analysis over Fourier. If the same signal had been analyzed by the Fourier transform, we would not have been able to detect the instant when the signal's frequency changed, whereas it is clearly observable here.