Digital Signal Processing Reference
In-Depth Information
The following program created the graphs of waves above.
%
% Given an input signal, break it down with DWT.
% Show the contribution of several channels of the DWT.
%
% example: input = floor(rand(1,100)*256);
% addwaves3(input, db2);
% Works for haar and db2 (Haar is the default)
%
function addwaves3(input, wavelet)
% Get the Daubechies2 wavelet/scaling coeffs
if (strcmp(wavelet,db2))
[LPF, HPF, ILPF, IHPF] = myDB2;
else
[LPF, HPF, ILPF, IHPF] = myHaar;
end
% Do the wavelet transform
L = downsample(myconv2(input, LPF));
H = downsample(myconv2(input, HPF));
%[LL, LH] = myDWT(L);
LL = downsample(myconv2(L, LPF));
LH = downsample(myconv2(L, HPF));
%[LLL, LLH] = myDWT(LL);
LLL = downsample(myconv2(LL, LPF));
LLH = downsample(myconv2(LL, HPF));
% L is not needed anymore, nor is LL
clear L LL
% Get the waves for each subsignals contribution
% This effectively finds the reconstruction.
if (strcmp(wavelet,db2))
% The ILow and IHigh functions are hard-coded for db2.
wave1 = ILow(ILow(ILow(LLL)));
wave2 = ILow(ILow(IHigh(LLH)));
wave3 = ILow(IHigh(LH));
wave4 = IHigh(H);
Search WWH ::




Custom Search