Single-level discrete 1-D wavelet transform (periodized).
Syntax
[cA,cD] = dwtper(X,'wname')
[cA,cD] = dwtper(X,Lo_D,Hi_D)
Description
dwtper is a one-dimensional wavelet analysis function.
[cA,cD] = dwtper(X,'wname') computes the approximation coefficients vector cA and detail coefficients vector cD, obtained by periodized wavelet decomposition of the vector X.
'wname' is a string containing the wavelet name (see wfilters).
Instead of giving the wavelet name, you can give the filters. When used with three arguments: [cA,cD] = dwtper(X,Lo_D,Hi_D), Lo_D is the decomposition low-pass filter and Hi_D is the decomposition high-pass filter.
If lx = length(X) then length(cA) = length(cD) = ceil(lx/2).
Examples
% Set initial signal and get filters.
x = sin(0.3*[1:300]); lx = length(x)
lx =
300
w = 'db9';
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(w);
% DWT with zero-padding signal extension.
[cazp,cdzp] = dwt(x,w);
% The transform uses some extra coefficients,
% at most 2 if lx is odd.
lxtzp = 2*length(cazp)
lxtzp =
316
% Reconstruction.
xzp = idwt(cazp,cdzp,w,lx);
% Error with zero-padding.
errzp = max(abs(x-xzp))
errzp =
7.3231e-12
% Periodized DWT.
[cap,cdp] = dwtper(x,w);
% The transform uses a minimum of extra coefficients.
lxtp = 2*length(cap)
lxtp =
300
% Reconstruction.
xp = idwtper(cap,cdp,w,lx);
% Error with periodized DWT.
errp = max(abs(x-xp))
errp =
1.4588e-11
Algorithm
The algorithm is the same as in dwt but the signal X is extended assuming periodicity. More precisely, if lx = length(X) is even, the extended signal is
extX = [X(lx-lf+1:lx) X X(1:lf)] where lf is the length of the filter. Then, usual convolution and downsampling operations are done, followed by keeping the central part of length lx/2.
See Also
dwt, idwtper
[ Previous | Help Desk | Next ]