Question about wavelet and reconstruction

조회 수: 3 (최근 30일)
tanglaoya
tanglaoya 2016년 9월 20일
댓글: tanglaoya 2016년 10월 6일
Dear all, I am studying wavelet and focusing on the signal reconstruction. I noticed that the function 'upcoef' just work for the reconstruction: http://cn.mathworks.com/help/wavelet/ref/upcoef.html
At the end of this page, I also noticed that upcoef is equivalent to an N time repeated use of the inverse wavelet transform.
Then I tried to test it with the following code:
t=0:2*pi/999:2*pi;
b0=sin(t);
figure,plot(b0);
[cA,cD]=dwt(b0,'db4',3);
D = upcoef('d',cD,'db4',3,length(b0));
figure,plot(D);
[cA,cD]=dwt(b0,'db4');
[cA,cD]=dwt(cA,'db4');
[cA,cD]=dwt(cA,'db4');
D=idwt([],cD,'db4');
D=idwt([],D,'db4');
D=idwt([],D,'db4',length(b0));
figure,plot(D)
However, results by two methods are different. Could anyone tell me what's wrong in the code?
Thanks, Tang Laoya
  댓글 수: 3
tanglaoya
tanglaoya 2016년 9월 20일
I changed code to the following:
t=0:2*pi/999:2*pi;
b0=sin(t);
figure,plot(b0);
[C,L]=wavedec(b0,3,'db4');
CA3=C(1:L(1));
CD3=C(L(1)+1:L(1)+L(2));
CD2=C(L(1)+L(2)+1:L(1)+L(2)+L(3));
CD1=C(L(1)+L(2)+L(3)+1:L(1)+L(2)+L(3)+L(4));
CD0 = upcoef('d',CD3,'db4',3,length(b0));
figure,plot(CD0);
%
[cA1,cD1]=dwt(b0,'db4');
[cA2,cD2]=dwt(cA1,'db4');
[cA3,cD3]=dwt(cA2,'db4');
D=idwt([],cD3,'db4');
D=idwt([],D,'db4');
cD0=idwt([],D,'db4',length(b0));
figure,plot(cD0)
errcA3=max(abs(CA3-cA3));
errCD3=max(abs(CD3-cD3));
errCD2=max(abs(CD2-cD2));
errCD1=max(abs(CD1-cD1));
errD=max(abs(CD0-cD0));
but results are still different.
tanglaoya
tanglaoya 2016년 9월 20일
Not only the roundoff error. I guess there is something wrong in the code. Thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Wayne King
Wayne King 2016년 10월 4일
One problem you are having is that DWT does not take the 3 input you are using. DWT only does a single-level wavelet transform unlike wavedec. The 3 input to DWT above is NOT being used. It has no effect on the output.
  댓글 수: 1
tanglaoya
tanglaoya 2016년 10월 6일
Hi Wayne, Thanks for your kindly reply. I did use wavedec in my latter comment, but the results are the same.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by