www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/ReturnDenoisedWaveletCoefficientsExample.m
%% Return Denoised Wavelet Coefficients % Load the example signal |nblocr1.mat|. Use the Haar wavelet and decompose % the signal down to level 2. Obtain the discrete wavelet transform and % denoise the signal. Return the wavelet coefficients of the noisy and % denoised signals. load nblocr1.mat; [sigden,coefs] = cmddenoise(nblocr1,'db1',2); [C,L] = wavedec(nblocr1,2,'db1'); %% % Plot reconstructions based on the level-2 approximation and level-2 and % level-1 detail coefficients for the noisy signal. app = wrcoef('a',C,L,'db1',2); subplot(3,1,1); plot(app); title('Approximation Coefficients'); for nn = 1:2 det = wrcoef('d',C,L,'db1',nn); subplot(3,1,nn+1) plot(det); title(['Noisy Wavelet Coefficients - Level '... num2str(nn)]); end %% % Plot reconstructions based on the approximation and detail coefficients % for the denoised signal at the same levels. figure; app = wrcoef('a',coefs,L,'db1',2); subplot(3,1,1); plot(app); title('Approximation Coefficients'); for nn = 1:2 det = wrcoef('d',coefs,L,'db1',nn); subplot(3,1,nn+1) plot(det); title(['Thresholded Wavelet Coefficients-Level '... num2str(nn)]); end %% % The approximation coefficients are identical in the noisy and denoised % signal, but most of the detail coefficients in the denoised signal are % close to zero.