www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/DoubleDensityWaveletTransformExample.m
%% Double-Density Wavelet Transform % Obtain the double-density wavelet transform of a signal with two discontinuities. % Use the level-one detail coefficients to localize the discontinuities. %% % Create a signal consisting of a 2-Hz sine wave with a duration of 1 second. % The sine wave has discontinuities at 0.3 and 0.72 seconds. N = 1024; t = linspace(0,1,1024); x = 4*sin(4*pi*t); x = x - sign(t - .3) - sign(.72 - t); plot(t,x); xlabel('t'); ylabel('x'); title('Original Signal'); %% % Obtain the double-density wavelet transform of the signal, reconstruct % an approximation based on the level-one detail coefficients, and plot % the result. wt = dddtree('ddt',x,1,'filters1'); wt.cfs{2} = zeros(1,512); xrec = idddtree(wt); plot(t,xrec,'linewidth',2) set(gca,'xtick',[0 0.3 0.72 1]); set(gca,'xgrid','on');