Coding wavelets the easy way

Testing the perfect reconstruction


Since we have implemented all of the elements of the diagram

reconstruct

we may check numerically that we have a perfect reconstruction if we use suitable filters. Such filters are given in non structured form in this mat-file.
The filters can be seen in the command window:
>> load Daub4
>> h

h =

-0.1294 0.2241 0.8365 0.4830

>> rh

rh =

0.4830 0.8365 0.2241 -0.1294

>> g

g =

-0.4830 0.8365 -0.2241 -0.1294

>> rg

rg =

-0.1294 -0.2241 0.8365 -0.4830


We see that rh (the reconstruction filter) is the mirror of h, and that rg is a mirror of g. Moreover, g is obtained from h by symmetry and a change of sign on the second and fourth value of h. The support of these filters are not given; however, we know that the reconstruction filter are the symmetric of the decomposition filters, i.e. their z-transform is obtained one from the other by replacing the indeterminate z by its inverse.

The purpose of this exercise is to check the perfect reconstruction of the diagram for the Daub4 set of filters (this will be on the support on the input and on the (larger) support of the output).
You will write the script in a file named "ReconstructionTest".
You will implement all the steps in the diagram and plot the difference between the input and the output on the support of each. Caution: the output starts before the input and end after it.
The error should have a magnitude of order 10-14. If you error is significantly greater, the most probable cause for error is in the handling of the field "d" of the signals and filters. Recheck then all of your routines.

The solution is here.

Summary


We have gathered all the previous code and checked that the perfect reconstruction (up to quantization errors) holds for the Daubechies 4 filters.