www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/InverseCWTofSpeechSignalUsingBumpWaveletExample.m

    %% Inverse Continuous Wavelet Transform Using Specified Wavelet
% Obtain the continuous wavelet transform of a speech sample and reconstruct
% the sample using the bump wavelet instead of the default Morse wavelet. 
load mtlb;
dt = 1/Fs;
t = 0:dt:numel(mtlb)*dt-dt;

%%
% Obtain and plot the CWT.
[bumpmtlb,f] = cwt(mtlb,Fs,'bump');
p1 = pcolor(t,f,abs(bumpmtlb));
p1.EdgeColor = 'none';
xlabel('Seconds'); 
ylabel('Hz');
%%
% Obtain the inverse CWT.
xrec = icwt(bumpmtlb,'bump','SignalMean',mean(mtlb));

%%
% Plot the original and reconstructed signals.
plot(t,mtlb);
xlabel('Seconds');
ylabel('Amplitude');
hold on;
plot(t,xrec,'r');
legend('Original','Reconstruction');
%%
% Play and compare the original and reconstructed signals.
p = audioplayer(mtlb,Fs);
play(p);
pause(2);
px = audioplayer(xrec,Fs);
play(px);