MATLAB: Stopband filter with multiple stopbands

filter

Hello, I have a fMRI signal sampled at 10 Hz and I need to create a stopband filter with three stop bands
This examle looks something like it but I dont quite understand it:
https://www.mathworks.com/matlabcentral/answers/503999-filtering-for-multiple-band-of-frequncies

Best Answer

This is a relatively straightforward problem.
Example —
Fs = 250;
fcomb = [[49 49.5 50.5 51], [49 49.5 50.5 51]+10, [49 49.5 50.5 51]+12.5];
mags = [[1 0 1], [0 1], [0 1]];
dev = [[0.5 0.1 0.5], [0.1 0.5], [0.1 0.5]];
[n,Wn,beta,ftype] = kaiserord(fcomb,mags,dev,Fs);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
figure
freqz(hh, 1, 2^20, Fs)
set(subplot(2,1,1), 'XLim',[45 65]) % Optional

set(subplot(2,1,2), 'XLim',[45 65]) % Optional
producing:
Make appropriate changes for your signal and requirements.