How can I create a bandpass FIR filter using firpm?
Show older comments
I have to create a bandpass FIR filter for an EEG signal with cutoff frequencies [1,8] Hz and sampling rate= 500, I wanted to first use the firpmord command to find the minimum order for the filter to work and then realize the same filter with the same specifics through both firpm and the windows method with fir1 trying the minimum order, and higher order and a lower order to show how the filter changes, but there are some problems:
- when trying to use firpmord I don't know how to choose the amplitude and the deviation, i chose to have a rp=0.5 and rs=30 in dB but I don't know how to link them to dev or how to choose the amplitude
- I tried the formula for the dev that is on the matlab example but I can't understand if it's right and why should I use this formula
- I can't understand how to use the w parameter that I get from appliying firpmord.
- I think I realized a highpass filter, can you tell me what I did wrong and how to correct the code?
- If you're confident with filters applied to EEG do you think that I chose good values for rp and rs? Should I change them?
Here's the code:
fFIR= [1 8]; % frequenza di taglio in Hz
a=[0 1]; %ampiezza desiderata
rp= 0.5; %ripple banda passante in dB
rs= 30; %ripple banda di stop in dB
fs=500; % frequenza di campionamento in Hz
dev = [ 10^(-rs/20) (10^(rp/20)-1)/(10^(rp/20)+1)];
%ricavo l'ordine minimo del filtro
[n,fo, ao, w]=firpmord(fFIR,a,dev,fs);
b = firpm(n,fo,ao,w);
freqz(b,1,1024,fs)
title('Filtro FIR passabanda con frequenze di taglio [1,8] Hz')
2 Comments
Paul
on 8 Oct 2023
Hi FRANCESCA,
For this part of your question:
- I think I realized a highpass filter, can you tell me what I did wrong and how to correct the code?
FRANCESCA SANASI
on 8 Oct 2023
Accepted Answer
More Answers (0)
Categories
Find more on Frequency Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


