How can I apply DWT, Threshold method, then iDWT for ECG signal?

1 view (last 30 days)
Hi Everyone, I have ECG signal and I want to apply: 1- dwt 2- threshold method 3- idwt for ECG signal de-nosing. But I faced some problem with second and third stage (threshold and idwt) my question is how can I solve that. My code is
S=load('data.mat'); % ECG Signal
y1=S.sig209;
nsig = awgn(y1,15); % Generate White Gaussian Noise with SNR=15
sig1=y1+nsig; % add noise to orignal Signal
OPsig=wden(sig1,'rigrsure','s','sln',6,'sym7'); %1-D de-noising
[AA,DD] = dwt(OPsig,'sym7'); % Applay DWT
%%%Apply Threshold method
Sigma = median(abs(nsig))/0.6745; % Equation Donoho and Johnstone (1994)
thresh = Sigma*sqrt(2*log(length(OPsig)));
Csig = idwt(AA,DD,'sym7');
subplot(3,1,1),plot(y1,'k'), axis([1 2000 -1 1]), grid on
title('Orignal Signal')
ylabel('Amplitude')
xlabel('Signal duration')
subplot(3,1,2),plot(sig1,'r'), axis([1 2000 -2 2]) , grid on
title('Orignal Signal with white Gaussian noise')
ylabel('Amplitude')
xlabel('Signal duration')
OSNR=snr(y1,Csig-y1);
subplot(3,1,3),plot(Csig), axis([1 2000 -1 1]),title(['Optimal De-noising Signal',' ; OUTPUT SNR= ',num2str(OSNR)]) , grid on
ylabel('Amplitude')
xlabel('Signal duration')

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!