MATLAB: Do the values of the length of DWT2 coefficients for different modes (as specified in the help) differ from the actual formula

bordercoefficientdistortiondwt2dwtmodelengthpersymwaveletWavelet Toolbox

The length of the coefficient obtained from DWT2 is sx/2 for the dwtmode value 'sym' and it is (sx+If-1)/2 for the rest of the modes. In the help for this function, instead of 'sym' it is specified for the mode 'per', though in the Wavelet Toolbox, the formula for length of the coefficient is correctly implemeted. The actual formula is given in the book: Wavelets and Filter Banks by Gilbert Strang/Truong Nguyen, chapter 8.2.

Best Answer

This enhancement has been incorporated in Release 2008b (R2008b). For previous product releases, read below for any possible workarounds:
This is an error in the documentation. In the help page for the function DWT2, the following is stated:
Let sx = size(X) and lf = the length of filters; then size(cA) = size(cH) = size(cV) = size(cD) = sa
where sa = ceil(sx/2), if the DWT extension mode is set to periodization. For the other extension modes, sa = floor((sx+lf-1)/2).
It should actully read as:
Let sx = size(X) and lf = the length of filters; then size(cA) = size(cH) = size(cV) = size(cD) = sa
where sa = ceil(sx/2), if the DWT extension mode is set to symmetric padding . For the other extension modes, sa = floor((sx+lf-1)/2).
Note: The difference is, in the DWT Extension mode should be specified as a "symmetric padding".