Remove the 20 Hz low frequency and 95 Hz high frequency from an ecg signal with bandpass filter
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
close all
clear all
M=dlmread('FOETAL_ECG.dat')
v=M(:,3)
figure
subplot(4,1,1),plot(v)
Fe=250;
Te=1/Fe;
n=length(v);
t=(0:n-1)/Fe;
subplot(4,1,2),plot(t,v),
V=fft(v);
sp=abs(V);
%ff=((0:n-1)*Fe)/n
ff=(0:(n-1))/n*Fe;
subplot(4,1,3),
plot(ff(1:length(ff)/2),sp(1:length(sp)/2));
N=4;
Wn= [19 96];
filtru=fir1(N,Wn/(Fe/2),'bandpass')
semnalfiltrat_fir1=filter(filtru,1,v/100);
subplot(4,1,4),plot(t,semnalfiltrat_fir1),
figure
subplot(2,1,1),plot(t,v),
subplot(2,1,2),plot(t,semnalfiltrat_fir1),
H_fir1=abs(a);
figure
plot(b,H_fir1),
1 commentaire
Star Strider
le 17 Déc 2021
Removing those specific frequencies requires either an IIR bandstop filter for each, or a FIR filter that can remove both at the same time. The problem is that filtering out the 20 Hz signal will also filter out a significant part of the EKG record (usually considerd to span 0 Hz to 100 Hz).
Since I seriously doubt that this would ever be a real-world situation, I assume this is a homework problem.
We give hints for homework problems, so I have here.
.
Réponses (1)
Ashutosh Singh Baghel
le 20 Déc 2021
Modifié(e) : Ashutosh Singh Baghel
le 20 Déc 2021
Hi Denis,
I understand that you wish to remove several freq peaks from a signal, this can be achived by using two bandstop filters centered at the frequencies to be removed. Follow the folloing example for a better understanding. A signal having multiple frequency contents is passed through a bandstop filter of center frequency as 95Hz. the output of filter 'X_out' is then plotted later.
Here
fs = 500; %Sampling Frequency
t = 0:1/fs:4-1/fs; %time axis
x1 = sin(2*pi*t*20); %signal one with 20Hz
x2 = sin(2*pi*t*40); %signal two with 40Hz
x3 = sin(2*pi*t*95); %signal three with 95Hz
x4 = sin(2*pi*t*45); %signal four with 45Hz
X = x1+x2+x3+x4; %signal containing all
[pxx,fxx] = pspectrum(X,fs);
plot(fxx,pow2db(pxx))
N_1 = 10; % Order
Fstop1_1 = 94; % First Stopband Frequency
Fstop2_1 = 96; % Second Stopband Frequency
Astop_1 = 80; % Stopband Attenuation (dB)
% Construct an FDESIGN object and call its CHEBY2 method.
h_1 = fdesign.bandstop('N,Fst1,Fst2,Ast', N_1, Fstop1_1, Fstop2_1, Astop_1, fs);
Hd_95 = design(h_1, 'cheby2');
X_ans = filter(Hd_95,X);
[pxx_out,fxx_out] = pspectrum(X_ans,fs);
plot(fxx_out,pow2db(pxx_out))
Similarly, a 20Hz bandstop filter can be designed. Follow the MATLAB documentation link on filterDesign, and how to filter data.
0 commentaires
Voir également
Catégories
En savoir plus sur Filter Design dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!