You are on page 1of 5

NAG Toolbox for Matlab

c09aa
1 Purpose
c09aa returns the details of the chosen discrete wavelet lter. For a chosen mother wavelet, discrete
wavelet transform type (single-level or multi-level DWT) and end extension method, this routine returns
the number of levels of resolution (appropriate to a multi-level transform), the lter length, and, the
number of approximation and detail coefcients, or the total number of coefcients (for single-level or
multi-level DWTs respectively). This function must be called before any of the transform functions in this
chapter.
2 Syntax
[nwl, nf, nwc, icomm, ifail] = c09aa(wavnam, wtrans, mode, n)
3 Description
One-dimensional discrete wavelet transforms (DWT) are characterised by the mother wavelet, the end
extension method and whether multiresolution analysis is to be performed. For the selected combination
of choices for these three characteristics, and for a given length (n) of data array, c09aa returns the
dimension details for the transform determined by this combination. The dimension details are: n
l
, the
number of levels of resolution that would be computed were a multi-level DWT applied, n
f
, the lter
length, and n
c
the number of approximation and detail coefcients for single-level DWTs and the total
number of coefcients for multi-level DWTs that would be generated by the transform. These values are
also stored in the communication array icomm, as are the input choices, so that they may be conveniently
communicated to the transform functions in this chapter.
4 References
None.
5 Parameters
5.1 Compulsory Input Parameters
1: wavnam string
The name of the mother wavelet. See the C09 Chapter Introduction for details.
wavnam HAAR
Haar wavelet.
wavnam DB2
Daubechies wavelet with 2 vanishing moments (4 coefcients).
wavnam DB3
Daubechies wavelet with 3 vanishing moments (6 coefcients).
wavnam DB4
Daubechies wavelet with 4 vanishing moments (8 coefcients).
wavnam DB5
Daubechies wavelet with 5 vanishing moments (10 coefcients).
wavnam DB6
Daubechies wavelet with 6 vanishing moments (12 coefcients).
wavnam DB7
Daubechies wavelet with 7 vanishing moments (14 coefcients).
C09 Wavelet Transforms c09aa
[NP3663/22] c09aa.1
wavnam DB8
Daubechies wavelet with 8 vanishing moments (16 coefcients).
wavnam DB9
Daubechies wavelet with 9 vanishing moments (18 coefcients).
wavnam DB10
Daubechies wavelet with 10 vanishing moments (20 coefcients).
wavnam BIOR1:1
Biorthogonal wavelet of order 1.1.
wavnam BIOR1:3
Biorthogonal wavelet of order 1.3.
wavnam BIOR1:5
Biorthogonal wavelet of order 1.5.
wavnam BIOR2:2
Biorthogonal wavelet of order 2.2.
wavnam BIOR2:4
Biorthogonal wavelet of order 2.4.
wavnam BIOR2:6
Biorthogonal wavelet of order 2.6.
wavnam BIOR2:8
Biorthogonal wavelet of order 2.8.
wavnam BIOR3:1
Biorthogonal wavelet of order 3.1.
wavnam BIOR3:3
Biorthogonal wavelet of order 3.3.
wavnam BIOR3:5
Biorthogonal wavelet of order 3.5.
wavnam BIOR3:7
Biorthogonal wavelet of order 3.7.
Constraint: wavnam HAAR, DB2 , DB3 , DB4 , DB5 , DB6 , DB7 , DB8 , DB9 , DB10 ,
BIOR1:1 , BIOR1:3 , BIOR1:5 , BIOR2:2 , BIOR2:4 , BIOR2:6 , BIOR2:8 , BIOR3:1 ,
BIOR3:3 , BIOR3:5 or BIOR3:7.
2: wtrans string
The type of discrete wavelet transform that is to be applied.
wtrans S
Single level decomposition or reconstruction by discrete wavelet transform.
wtrans M
Multi-level resolution, by a multi-level DWT or its inverse.
Constraint: wtrans S or M.
3: mode string
The end extension method.
mode P
Periodic end extension.
mode H
Half-point symmetric end extension.
c09aa NAG Toolbox for Matlab Manual
c09aa.2 [NP3663/22]
mode W
Whole-point symmetric end extension.
mode Z
Zero end extension.
Constraints:
if wtrans S , mode P , H, W or Z ;
if wtrans M, mode H, W or Z.
4: n int32 scalar
The number of elements, n, in the data array x.
Constraint: n 2.
5.2 Optional Input Parameters
None.
5.3 Input Parameters Omitted from the MATLAB Interface
None.
5.4 Output Parameters
1: nwl int32 scalar
The maximum number of levels of resolution, n
l
, that can be computed when a multi-level discrete
wavelet transform is applied. It is such that 2
n
l
n < 2
n
l
1
, for n
l
an integer.
2: nf int32 scalar
The lter length, n
f
, for the supplied mother wavelet. This is used to determine the number of
approximation coefcients that are appropriate to each level of a multi-level DWT.
3: nwc int32 scalar
For a single level transform (wtrans S ), the number of approximation coefcients that would be
generated for the given problem size, mother wavelet, extension method and type of transform; this
is also the corresponding number of detail coefcients. For a multi-level transform (wtrans M)
the total number of coefcients that would be generated over all levels of resolution.
4: icomm100 int32 array
Contains details of the wavelet transform and the problem dimension which is to be communicated
to the transform functions in this chapter.
5: ifail int32 scalar
ifail 0 unless the function detects an error (see Section 6).
6 Error Indicators and Warnings
Errors or warnings detected by the function:
ifail 1
On entry, wavnam 6 HAAR, DB2 , DB3 , DB4 , DB5 , DB6 , DB7 , DB8 , DB9 , DB10 ,
BIOR1:1 , BIOR1:3 , BIOR1:5 , BIOR2:2 , BIOR2:4 , BIOR2:6 , BIOR2:8 , BIOR3:1 ,
BIOR3:3 , BIOR3:5 or BIOR3:7.
C09 Wavelet Transforms c09aa
[NP3663/22] c09aa.3
ifail 2
On entry, wtrans 6 S or M.
ifail 3
On entry, mode 6 P , H, W or Z,
or mode P and wtrans M.
ifail 4
On entry, n < 2.
7 Accuracy
Not applicable.
8 Further Comments
None.
9 Example
n = int32(8);
wavnam = Haar;
mode = zero;
wtrans = Multilevel;
x = [2; 5; 8; 9; 7; 4; -1; 1];
fprintf(\n Input Data:\n);
fprintf(%8.3f, x);
fprintf(\n\n);
% Query wavelet filter dimensions
[nwl, nf, nwc, icomm, ifail] = c09aa(wavnam, wtrans, mode, n);
if ifail == int32(0)
% Perform Discrete Wavelet transform
[c, dwtlev, icomm, ifail] = c09cc(x, nwc, nwl, icomm);
if ifail == int32(0)
fprintf( Length of wavelet filter : %10d\n, nf);
fprintf( Number of Levels : %10d\n\n, nwl);
fprintf( Number of coefficients in each level :\n );
fprintf( %8d, dwtlev);
fprintf(\n);
fprintf( Total number of wavelet coefficients : %10d\n\n, nwc);
fprintf( Wavelet coefficients C : \n);
fprintf( %8.3f, c);
fprintf(\n);
% Reconstruct original data
[y, ifail] = c09cd(nwl, c, n, icomm);
if ifail == int32(0)
fprintf(\n Reconstruction Y : \n);
fprintf( %8.3f, y);
fprintf(\n);
end
end
end
Input Data:
2.000 5.000 8.000 9.000 7.000 4.000 -1.000 1.000
Length of wavelet filter : 2
c09aa NAG Toolbox for Matlab Manual
c09aa.4 [NP3663/22]
Number of Levels : 3
Number of coefficients in each level :
1 1 2 4
Total number of wavelet coefficients : 8
Wavelet coefficients C :
12.374 4.596 -5.000 5.500 -2.121 -0.707 2.121 -1.414
Reconstruction Y :
2.000 5.000 8.000 9.000 7.000 4.000 -1.000 1.000
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
C09 Wavelet Transforms c09aa
[NP3663/22] c09aa.5 (last)

You might also like