How to create a wiener filter?

13 views (last 30 days)
weathus
weathus on 21 Dec 2012
Hello,
I have a problem creating a wiener filter. The purpose of this exercise was to design a wiener filter and apply it to a given ecg signal.
I have created a variable 'model' which contains the desired optimal signal, I created this with ones and linspace, visually.
Then I selected 4 T-P intervals, which are iso-electric and thus can be used for modelling the sound. (I plotted the signal and used ginput to select the points)
%P-T-segments
A1= [ecg(x1(1):x1(2))]; A2= [ecg(x1(3):x1(4))]; A3= [ecg(x1(5):x1(6))]; A4= [ecg(x1(7):x1(8))];
%removing DC-component by substracting mean
A1=A1-mean(A1); A2=A2-mean(A2); A3=A3-mean(A3); A4=A4-mean(A4);
%calculating PSD of noise segemnts
noise = zeros([4,700]); noise(1,:) = abs(fft(A1,700)).^2; noise(2,:)=abs(fft(A2,700)).^2; noise(3,:)=abs(fft(A3,700)).^2; noise(4,:)=abs(fft(A4,700)).^2;
%average noise PSD
noise_PSD_estimate = mean(noise,1);
%signal PSD
signal_PSD=abs(fft(model,700)).^2;
I hope I correctly calculated the PSD's. but now I am stuck. We were given that the transfer function of the wiener filter was W(f)= Sd(f)/(Sd(f)+Sn(f)) with Sd=power spectral density of the desired signal, and Sd=power spectral density of the noise
thus I created a filter b=signal_PSD; a=signal_PSD+noise_PSD;
y=filter(b,a,example_beat);
but when plotting this, It didn't give any good results....
Help is appreciated...

Answers (0)

Community Treasure Hunt

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

Start Hunting!