Abhinav Aggarwal
Abhinav Aggarwal

Reputation: 1363

Wavedec in matlab returns length with sum greater than the original length of signal

I was doing multilevel wavelet decomposition for a signal 'price1' by using

 [c1, l] = wavedec(price1, 3, 'db4');

The size of price1 was:

size(price1) =

   240     1

And the size of wavelet decomposition obtained i.e length of l is:

l =

    36
    36
    65
   123
   240

I am a beginner, and I think the size should be:

l =

    30
    30
    60
   120
   240

I am not able to understand why is the size not half of the signal size? Is this some sort of padding happening internally? And I would want the size to be half like [30; 30; 60; 120; 240]. What can I do to achieve it?

Thanks for your help :)

Upvotes: 1

Views: 772

Answers (1)

Rash
Rash

Reputation: 4336

You are not considering the length of mother wavelet, which will change the length of signal after convolution.

db4 has the length of 8,

 a = randi(10,[240 1]);
 [c1, l] = wavedec(a, 3, 'db4');

l =
36
36
65
123
240

But for example db8 has the length of 16

[c1, l] = wavedec(a, 3, 'db8');

l =
43
43
71
127
240

You can have access to wavelet functions like this,

[LoD,HiD,LoR,HiR] = wfilters('db8');

Upvotes: 1

Related Questions