how dwt and wavedec are different ? here why cA1 and C have diffrent values?

5 views (last 30 days)
data=xlsread('E:\color\neha.xlsx');
data= data';
value1=data(1,:);
chan1= value1-mean(value1);
[cA1,cD1] = dwt(chan1,'db4');
[cA2,cD2] = dwt(cA1,'db4');
[cA3,cD3] = dwt(cA2,'db4');
[cA4,cD4] = dwt(cA3,'db4');
[cA5,cD5] = dwt(cA4,'db4');
[cA6,cD6] = dwt(cA5,'db4');
[cA7,cD7] = dwt(cA6,'db4');
[cA8,cD8] = dwt(cA7,'db4');
[cA9,cD9] = dwt(cA8,'db4');
[cA10,cD10] = dwt(cA9,'db4');
[C,L] = wavedec(chan1,10,'db4');
  1 Comment
Raul Souza Muniz
Raul Souza Muniz on 5 Jul 2021
Can I ask you something ? Do I have to do this manually. I mean, could I make an matrix and put all the c values and D values in the matrix with a for loop ? I cannot see a way to do this, because there is a long time since I programed in matlab. Really sorry for my dumb question.
Thank you very much

Sign in to comment.

Accepted Answer

Wayne King
Wayne King on 9 Mar 2013
Edited: Wayne King on 9 Mar 2013
As you see, dwt() gives only a level 1 DWT, while wavedec gives you multiple levels. But you are correct that wavedec() simply iterates on the approximation coefficients of the previous level as expected.
Why do you say they are different? I do not see it. The first L(1) elements of wavedec should equal cA10 above
chan1 = randn(1024,1);
[cA1,cD1] = dwt(chan1,'db4');
[cA2,cD2] = dwt(cA1,'db4');
[cA3,cD3] = dwt(cA2,'db4');
[cA4,cD4] = dwt(cA3,'db4');
[cA5,cD5] = dwt(cA4,'db4');
[cA6,cD6] = dwt(cA5,'db4');
[cA7,cD7] = dwt(cA6,'db4');
[cA8,cD8] = dwt(cA7,'db4');
[cA9,cD9] = dwt(cA8,'db4');
[cA10,cD10] = dwt(cA9,'db4');
[C,L] = wavedec(chan1,10,'db4');
Now compare:
C(1:L(1))
with
cA10
Likewise, compare
C(L(1)+1:L(1)+L(2))
with
cD10
  2 Comments
amit_neuro
amit_neuro on 9 Mar 2013
Edited: amit_neuro on 9 Mar 2013
thanks King. i got it.
But tell me on more thing, "is it necessary to reconstruct the cA10 to get the real signal?"
Wayne King
Wayne King on 9 Mar 2013
It's only necessary if you have gone down to that level in the multiresolution analysis, if you go down to level 10, then you need the the final level approximation coefficients to achieve perfect reconstruction.

Sign in to comment.

More Answers (2)

TONY SINGLA
TONY SINGLA on 17 Aug 2013
hello
i have a doubt that how DWT calculates the values for the cd1,ca1 and cd2,ca2 and so on............... which *|formula |*it uses to calculate the values for the respective C and L values in case of 1D-DWT at multilevel
reply please waiting for your reply

Murugesh
Murugesh on 3 Oct 2013
you refer waverec

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!