DSPRelated.com
Forums

Error using waverec when dwtmode set to 'per'

Started by MAST...@UWALUMNI.COM December 13, 2006
Hello,
I have a question regarding the wavelet decomposition and reconstruction using the functions wavedec and waverec.
I get an error during the reconstruction process when I set the dwtmode option to 'per'.

The code I use is as follows:
-----------------------------------
dwtmode('per')
x = random('unif', 0, 1, 512, 1);
[y, L] = wavedec(x, 9, 'db2');
x_rec = waverec(y, L, 'db2');
-----------------------------------

Error messages:
-----------------------------------
??? Error using ==> plus
Matrix dimensions must agree.

Error in ==> idwt at 84
x = upsconv1(a,Lo_R,lx,dwtEXTM,shift) + upsconv1(d,Hi_R,lx,dwtEXTM,shift);

Error in ==> appcoef at 54
a = idwt(a,d,Lo_R,Hi_R,l(imax-p));

Error in ==> waverec at 30
x = appcoef(c,l,varargin{:},0);
-----------------------------------

In the help for dwtmode it says that the dwtmode option applies to all processes using dwt and idwt (which would include wavedec and waverec), according to the following lines:

"All functions and GUI tools that use the DWT (1-D & 2-D) or
Wavelet Packet (1-D & 2-D) use the specified DWT extension mode."

Note that this error does not occur if the dwtmode option is set to 'sym', but I need to use the 'per' mode in my application.

Thanks for any help on how to go around this error.
Daniel