%% Bandpass FIR Filter
% Design a 20th-order bandpass FIR filter with lower cutoff frequency 500 Hz and higher cutoff frequency 560 Hz. The sample rate is 1500 Hz. Visualize the magnitude response of the filter. Use it to filter a random signal containing 1000 samples.

bpFilt = designfilt('bandpassfir','FilterOrder',20, ...
         'CutoffFrequency1',500,'CutoffFrequency2',560, ...
         'SampleRate',1500);
fvtool(bpFilt)
dataIn = randn(1000,1);
dataOut = filter(bpFilt,dataIn);

%
% Output the filter coefficients.

b = bpFilt.Coefficients

% Copyright 2015 The MathWorks, Inc.