필터 지우기
필터 지우기

Reconstruct the signal using wavelet

조회 수: 5 (최근 30일)
Fuad Numan
Fuad Numan 2012년 4월 6일
댓글: Alaa Gouda 2017년 3월 13일
I have a noisy signal , i want to decompose it and reconstruct a specific sub-band frequencies;
[C2,L2]=wavedec(xn,8,'db8');
% approximation coefficients
A1=wrcoef('a',C2,L2,'db8',1);
A2=wrcoef('a',C2,L2,'db8',2);
A3=wrcoef('a',C2,L2,'db8',3);
A4=wrcoef('a',C2,L2,'db8',4);
A5=wrcoef('a',C2,L2,'db8',5);
A6=wrcoef('a',C2,L2,'db8',6);
A7=wrcoef('a',C2,L2,'db8',7);
A8=wrcoef('a',C2,L2,'db8',8);
%detail coefficients
D1=wrcoef('d',C2,L2,'db8',1);
D2=wrcoef('d',C2,L2,'db8',2);
D3=wrcoef('d',C2,L2,'db8',3);
D4=wrcoef('d',C2,L2,'db8',4);
D5=wrcoef('d',C2,L2,'db8',5);
D6=wrcoef('d',C2,L2,'db8',6);
D7=wrcoef('d',C2,L2,'db8',7);
D8=wrcoef('d',C2,L2,'db8',8);
I have used "waverec" function to reconstruct the whole frequencies except the detail 1 (D1), I used
C=[A8;D8;D7;D6;D5;D4;D3;D2];
L=[length(A8);length(D8);length(D7);length(D6);length(D5);length(D4);length(D3);length(D2);length(xn)];
Rec_signal=waverec(C,L,'db8');
The resulted Rec_signal is too much different from the original signal even not close;
Is that a correct reconstruction code, or i have to sum the coefficients together.
I also want to try omitting other coefficients and rebuild the signal till i get what i want.
appreciate your help

채택된 답변

Wayne King
Wayne King 2012년 4월 6일
Are you sure you are getting tmp from
tmp = cumsum(L);
That output cannot be a non-integer, please show me your code and give me the length of your input signal.
  댓글 수: 1
Fuad Numan
Fuad Numan 2012년 4월 6일
Oh, sorry I missed that one.
Now it is ok
tmp(end-2)+1 = 1111
tmp(end-1) = 2117
which confirms the length of D1
Thank you

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

추가 답변 (1개)

Wayne King
Wayne King 2012년 4월 6일
You are using the incorrect input to waverec. waverec expects that the input is the wavelet and scaling coefficients. However you are inputting the output of wrcoef, which is not the wavelet and scaling coefficients.
The output of wrcoef are projections onto vector subspaces, they are the same length as the input signal. Just set the d1 coefficients in the output from wavedec to zero to get what you are looing for and input that into waverec.
load noisdopp;
[C,L] = wavedec(noisdopp,8,'db8');
Cnew = C;
tmp = cumsum(L);
Cnew(tmp(end-2)+1:tmp(end-1)) = 0;
Rec_signal=waverec(Cnew,L,'db8');
plot(noisdopp,'k'); hold on;
plot(Rec_signal,'r','linewidth',2);
  댓글 수: 2
Fuad Numan
Fuad Numan 2012년 4월 6일
Thank you Wayne
This is my first use of wavlet, this definitely solves my problem, but still cant get it. the indices you put to remove the D1 coefficients are floot (not integer).
how could I know in which range of Cnew indices each coefficient located in.
As per your script,
tmp(end-2)+1 = 3.8112
tmp(end-1) = 0.6585
while the length of D1 is 1007, given from
[D1,D2,D3,D4,D5,D6,D7,D8]=detcoef(C2,L2,[1 2 3 4 5 6 7 8]);
Alaa Gouda
Alaa Gouda 2017년 3월 13일
would you please can you help me in my code i decompose signal in 5 levels i want to remove A5 ,D1 How can I do it ???

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by