Reconstruct the signal using wavelet
9 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个)
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 个评论
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 Center 和 File Exchange 中查找有关 Discrete Multiresolution Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!