From: Nyan Myo Naing on
Dear All,
I am wondering the wavelet decomposition implementation in Matlab.
In wavelet decomposition using the command "wavedec", the number of coefficients in each level should be
(length of original signal)/(2^j) where j = 1,2,3,....n
For example, if the length of the original signal is 3600, it should be
j = 1 -> 1800
j = 2 -> 900
j = 3 -> 450
j = 4 -> 225
j = 5 -> 112

But in matlab,
number of coefficients are
j = 1 -> 1804
j = 2 -> 906
j = 3 -> 457
j = 4 -> 233
j = 5 -> 121

Could sbd explain the discrepancy?
Thanks
From: Nyan Myo Naing on
Thanks, I know now.
Bcz it goes by convolution.
http://www.mathworks.es/access/helpdesk/help/toolbox/wavelet/ch01_i11.html
Thanks



"Nyan Myo Naing" <nyannmn(a)gmail.com> wrote in message <i13tct$hv$1(a)fred.mathworks.com>...
> Dear All,
> I am wondering the wavelet decomposition implementation in Matlab.
> In wavelet decomposition using the command "wavedec", the number of coefficients in each level should be
> (length of original signal)/(2^j) where j = 1,2,3,....n
> For example, if the length of the original signal is 3600, it should be
> j = 1 -> 1800
> j = 2 -> 900
> j = 3 -> 450
> j = 4 -> 225
> j = 5 -> 112
>
> But in matlab,
> number of coefficients are
> j = 1 -> 1804
> j = 2 -> 906
> j = 3 -> 457
> j = 4 -> 233
> j = 5 -> 121
>
> Could sbd explain the discrepancy?
> Thanks
From: Wayne King on
"Nyan Myo Naing" <nyannmn(a)gmail.com> wrote in message <i13tct$hv$1(a)fred.mathworks.com>...
> Dear All,
> I am wondering the wavelet decomposition implementation in Matlab.
> In wavelet decomposition using the command "wavedec", the number of coefficients in each level should be
> (length of original signal)/(2^j) where j = 1,2,3,....n
> For example, if the length of the original signal is 3600, it should be
> j = 1 -> 1800
> j = 2 -> 900
> j = 3 -> 450
> j = 4 -> 225
> j = 5 -> 112
>
> But in matlab,
> number of coefficients are
> j = 1 -> 1804
> j = 2 -> 906
> j = 3 -> 457
> j = 4 -> 233
> j = 5 -> 121
>
> Could sbd explain the discrepancy?
> Thanks

Hi Nyan, It has to do with the length of the filter and the setting for boundary value replication. The default mode for boundary value replication is symmetric half-point extension. You will notice that changing the length of the wavelet filter will increase the number of coefficients.

x = randn(3600,1);
wf = 'sym4';
[Ca,Cd] = dwt(x,wf);
length(Ca)
wf = 'sym8';
[Ca,Cd] = dwt(x,wf);
length(Ca)

The wavelet filter has increased in length by 4 and the number of coefficients has also increased by 4.

If you wish to see the behavior you expected, you can set the dwtmode to periodization.

dwtmode('per')

Wayne
From: Nyan Myo Naing on

Thanks Wayne
"Wayne King" <wmkingty(a)gmail.com> wrote in message <i1476f$2p4$1(a)fred.mathworks.com>...
> "Nyan Myo Naing" <nyannmn(a)gmail.com> wrote in message <i13tct$hv$1(a)fred.mathworks.com>...
> > Dear All,
> > I am wondering the wavelet decomposition implementation in Matlab.
> > In wavelet decomposition using the command "wavedec", the number of coefficients in each level should be
> > (length of original signal)/(2^j) where j = 1,2,3,....n
> > For example, if the length of the original signal is 3600, it should be
> > j = 1 -> 1800
> > j = 2 -> 900
> > j = 3 -> 450
> > j = 4 -> 225
> > j = 5 -> 112
> >
> > But in matlab,
> > number of coefficients are
> > j = 1 -> 1804
> > j = 2 -> 906
> > j = 3 -> 457
> > j = 4 -> 233
> > j = 5 -> 121
> >
> > Could sbd explain the discrepancy?
> > Thanks
>
> Hi Nyan, It has to do with the length of the filter and the setting for boundary value replication. The default mode for boundary value replication is symmetric half-point extension. You will notice that changing the length of the wavelet filter will increase the number of coefficients.
>
> x = randn(3600,1);
> wf = 'sym4';
> [Ca,Cd] = dwt(x,wf);
> length(Ca)
> wf = 'sym8';
> [Ca,Cd] = dwt(x,wf);
> length(Ca)
>
> The wavelet filter has increased in length by 4 and the number of coefficients has also increased by 4.
>
> If you wish to see the behavior you expected, you can set the dwtmode to periodization.
>
> dwtmode('per')
>
> Wayne