%% Magnitude and Phase Response of Bandpass FIR Filter
% Design a 50th-order bandpass FIR filter with stopband frequencies 150 Hz and 350 Hz and passband frequencies 200 Hz and 300 Hz. The sample rate is 1000 Hz. Visualize the magnitude and phase response of the filter.

N = 50;
Fstop1 = 150;
Fstop2 = 350;

Fpass1 = 200;
Fpass2 = 300;

Fs = 1e3;

bpFilt = designfilt('bandpassfir','FilterOrder',N, ...
'StopbandFrequency1',Fstop1,...
'StopbandFrequency2',Fstop2,...
'PassbandFrequency1',Fpass1,...
'PassbandFrequency2',Fpass2,...
'SampleRate',Fs);

fvtool(bpFilt,'Analysis','freq')

% Copyright 2019 The MathWorks, Inc.