function TestWavelet(),
SampFreq = 100;
t=0:1/SampFreq:10;
sig = [sin(20*pi*t(1:round(end/2))) sin(60*pi*t((round(end/2)+1):end))];
[WT, FreqBins, Scales] = Wavelet_Morl(sig,2,512);
FreqBins = FreqBins * SampFreq;
figure(1)
clf
set(gcf,'Position',[20 100 300 220]);
set(gcf,'Color','w');
pcolor(t,FreqBins,abs(WT).^2);
colormap jet;
shading interp;
axis([min(t) max(t) min(FreqBins) max(FreqBins)]);
colorbar;
ylabel('Frequency / Hz');
xlabel('Time / sec');
title('Wavelet Scalogram')
figure(2)
clf
set(gcf,'Position',[20 100 300 220]);
set(gcf,'Color','w');
pcolor(t,FreqBins,real(WT));
colormap jet;
shading interp;
axis([min(t) max(t) min(FreqBins) max(FreqBins)]);
colorbar;
ylabel('Frequency / Hz');
xlabel('Time / sec');
title('Real Part of Wavelet Transform')
figure(3)
clf
set(gcf,'Position',[20 100 300 220]);
set(gcf,'Color','w');
pcolor(t,FreqBins,real(WT));
colormap jet;
shading interp;
axis([min(t) max(t) min(FreqBins) max(FreqBins)]);
colorbar;
ylabel('Frequency / Hz');
xlabel('Time / sec');
title('Imaginary Part of Wavelet Transform')
figure(4)
clf
PS = zeros(size(WT));
nzero = find(abs(WT)>max(max(abs(WT)))/10);
PS(nzero) = angle(WT(nzero));
set(gcf,'Position',[20 100 300 220]);
set(gcf,'Color','w');
pcolor(t,FreqBins,PS);
colormap jet;
shading interp;
axis([min(t) max(t) min(FreqBins) max(FreqBins)]);
colorbar;
ylabel('Frequency / Hz');
xlabel('Time / sec');
title('Phase Spectrum of Wavelet Transform')
[ 本帖最后由 pengzk 于 2008-1-22 00:05 编辑 ] |