You are on page 1of 5

This workbook demonstrates how to compute the two-dimensional discrete wavelet transform (DWT) at a single level

approximation coefficients matrix cA and details coefficients matrices cH, cV, and cD (horizontal, vertical, and diagonal, re

The routine in use is the C09EAF and C09ABF from the NAG Fortran Library.
http://www.nag.com/numeric/FL/nagdoc_fl23/pdf/C09/c09eaf.pdf
http://www.nag.com/numeric/FL/nagdoc_fl23/pdf/C09/c09abf.pdf

The documentation for the NAG numerical routines, tips & tricks how to use NAG in Excel, technical papers, and examples available for
download are at: http://www.nag.co.uk/numeric/nagandexcel.asp#nagexcel

The Discrete Wavelet Transform (DWT) is any wavelet transform for which the wavelets are discretely sampled. For two
the DWT is computed as a series of one-dimensional DWTs, first over columns of the input data, and then over rows of the interme
This produces four types of output coefficients: one set of approximation coefficients and three types of detail coefficients
information about the horizontal, vertical and diagonal components of the input data.

This workbook has two worksheets and three VBA (Visual Basic for Applications) Modules.
Worksheet "Data" contains the input matrix.
Worksheet "Result" contains the output coefficients matrix:
1. cA matrix is red color font.
2. cH matrix is blue color.
3. cV is green.
4. cD is purple.
You can execute the marco "NAG_2D_DWT" (or by CTRL-D) to open the DWT settings and perform the transformation. In the dialog, yo
select the name of the mother wavelet (HAAR, DB2, DB3, etc.), and the end extension method (Periodic, Half

The VBA Modules contain the code.
Module "Declarations" contains the declaration statements of the NAG routines used in this workbook. The statements are shipp
with the Fortran Library as a set of .bas files.
Module "Get_data" contains the functions that get the input matrix.
Module "DWT" contains functions that return 2D DWT, it will get the input matrix and perform DWT initialization routine, open
setting window and compute the 2D Discrete Wavelet Transform.

Please contact us with any questions at support@nag.co.uk.
dimensional discrete wavelet transform (DWT) at a single level, returning the
approximation coefficients matrix cA and details coefficients matrices cH, cV, and cD (horizontal, vertical, and diagonal, respectively).
how to use NAG in Excel, technical papers, and examples available for
are discretely sampled. For two-dimensional data sets
dimensional DWTs, first over columns of the input data, and then over rows of the intermediate result.
This produces four types of output coefficients: one set of approximation coefficients and three types of detail coefficients, containing
D) to open the DWT settings and perform the transformation. In the dialog, you can
select the name of the mother wavelet (HAAR, DB2, DB3, etc.), and the end extension method (Periodic, Half-point, etc.).
Module "Declarations" contains the declaration statements of the NAG routines used in this workbook. The statements are shipped together
Module "DWT" contains functions that return 2D DWT, it will get the input matrix and perform DWT initialization routine, open the arguments
8.00 7.00 3.00 3.00 1.00 1.00
4.00 6.00 1.00 5.00 2.00 9.00
8.00 1.00 4.00 9.00 3.00 7.00
9.00 3.00 8.00 2.00 4.00 3.00
1.00 3.00 7.00 1.00 5.00 2.00
4.00 3.00 7.00 7.00 6.00 1.00
6.3591 10.3477 8.0995 10.3210 8.7587 3.5783 0.4100 -0.1827 1.5354 0.0784
11.5754 6.3762 12.1704 7.4521 8.6977 14.8535 2.3496 -0.9422 2.3780 -1.0540
2.0630 8.4499 15.4726 12.1764 3.8920 2.7112 -1.2690 0.0152 -6.9338 -1.7435
10.2143 6.2445 13.8571 8.1060 7.7701 13.2127 0.6317 -0.0969 2.3300 0.4637
6.3353 8.7805 10.2727 10.0472 6.8614 7.5814 -0.2343 0.3923 5.5457 2.1818
11.7141 11.1018 5.2923 8.1272 14.5540 2.5729 -1.8880 0.8142 -4.8552 0.0736
1.5365 5.9678 3.4309 -1.0585 -5.0275 -4.8492 0.4777 1.0230 -0.3147 0.0625
0.6779 -0.0294 -5.3274 1.6483 4.8689 -1.8383 1.0689 1.5671 -2.1422 0.5565
-1.1065 -2.8791 0.1535 0.0982 0.8417 2.8923 -0.9555 -1.9276 0.9195 -0.2228
-0.1359 -2.6633 -5.8549 1.8440 6.2403 0.5697 0.2899 0.4453 -0.5695 0.1541
1.4244 5.2140 1.6410 -0.4669 -3.2369 -4.5757 0.4944 1.4145 0.3488 -0.1187
1.0288 2.2521 0.0574 -0.1359 -0.5170 -2.6854 -1.3753 -2.5224 1.7581 -0.4316
0.8101 -1.3594
2.7743 -2.2648
-1.6917 1.2388
0.6365 -0.1162
0.2103 -0.8573
-2.7395 3.3590
0.0831 -1.3316
1.7593 -2.8097
-0.5125 2.6989
0.4749 -0.7946
-0.6212 -1.5177
-1.1835 3.7547

You might also like