Borrar filtros
Borrar filtros

How can I apply or implement fir1 filter

15 visualizaciones (últimos 30 días)
Dhiyaa Al-Shammari
Dhiyaa Al-Shammari el 29 de Nov. de 2019
Comentada: Star Strider el 30 de Nov. de 2019
I want to apply a 12-order low pass filter with a 35 Hz cut-off frequenc for a given ECG signal , the ECG sample rate 360 Hz.
is this code ok or not, I will attach the ECG signal with code .
Applying an order n = 12 FIR filter with the given frequency cut-off w = 35 Hz . correct it if its not correct.
n=12;
wn=35; % Represent cutoff frequency
x=fir1(n,wn,'low');
plot(x);

Respuesta aceptada

Star Strider
Star Strider el 29 de Nov. de 2019
Editada: Star Strider el 29 de Nov. de 2019
Try this:
D = load('100m.mat');
EKG = D.val; % Signal
L = numel(EKG); % Signal Length (Samples)
Fs = 360; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
t = linspace(0, L, L)/Fs; % Time Vector
b = fir1(12, (35/Fn)); % Order 12 FIR LPF Fco = 35 Hz
EKGfilt = filtfilt(b,1,EKG); % Filter Signal
figure
freqz(b,1, 2^12, Fs) % Display Filter Bode Plot
figure
plot(t, EKG)
hold on
plot(t, EKGfilt)
hold off
grid
The filter does not appear to be very effective, however it is what you requested, and from the freqz plot, has approximately 6 dB attenuation at 35 Hz.
EDIT — (29 Nov 2019 at 13:54)
Changed filter to filtfilt, since there appears to be significant phase delay usiung filter, even thouigh this is a FIR filter.
  2 comentarios
Dhiyaa Al-Shammari
Dhiyaa Al-Shammari el 30 de Nov. de 2019
Thanks a lot dear brother forhelping me
Best Regards
Dhiyaa
Star Strider
Star Strider el 30 de Nov. de 2019
As always, my pleasure!
The filter can be significantly improved simply by increasing its order. I encourage you to experiment with that.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by