Finite Impulse Response
Band Pass Filter
MATLAB IMPLEMENTATION
Band Pass Filter [ BPF ]
Aband-pass filter or BPF, is a device that passes frequencies within a
certain range and rejects frequencies outside that range.
These filters can also be created by combining a low-pass filter with a
high-pass filter.
An ideal band-pass filter would have a completely flat passband (e.g. with
no gain/attenuation throughout) and would completely attenuate all
frequencies outside the passband. Additionally, the transition out of the
passband would have brickwall characteristics.
In practice, no band-pass filter is ideal. The filter does not attenuate all
frequencies outside the desired frequency range completely; in particular,
there is a region just outside the intended passband where frequencies
are attenuated, but not rejected.
Finite Impulse Response [ FIR ]
In signal processing, a finite impulse response (FIR) filter is a
filter whose impulse response (or response to any finite
length input) is of finite duration, because it settles to zero in
finite time. This is in contrast to infinite impulse response
(IIR) filters, which may have internal feedback and may
continue to respond indefinitely (usually decaying). A direct form discrete-time FIR filter of
order N. The top part is an N-stage delay line
with N + 1 taps. Each unit delay is a Z-
inverse operator in Z-transform notation.
Problem Statement
Design a Band-Pass Linear Phase FIR Filter of Order 11 having pass band from
4kHz to 6kHz using MATLAB. Take sampling rate of 18kHz for it’s implementation.
Plot “Frequency Response” of the filter.
 To design an FIR filter, we used Kaiser Window of order 11
Initialization
```
% Sampling Frequency
Fs= 18000;
% Band Limit 4kHz - 6 kHz
Passband= [4000 6000];
% Magnitude for Passband and Stopband
Magnitudes= [1 0];
% Passband Ripple and Stopband Ripple
Deviations= [0.04 0.01];
```
Kaiser Order
For Kaiser Window, we need a beta (ɞ) value.
Which will be used for Bessel function I˳(ɞ).
Instead of taking arbitrary value of beta, we used
“Kaiser Order Function” to determine it’s value.
```
[N, Wn, beta, ftype]= kaiserord(Passband,
Magnitudes, Deviations, Fs);
```
Window Preparation
% Since we've to create 11 order FIR BPF
% Suggested Beta: 3.3953
n= 11;
Window= kaiser(n+1, beta);
Filter Preparation
% Suitable Frequency Constraints for FIR
filter
wn=[Passband(1) Passband(2)]/(Fs/2);
Filter= fir1(n, wn, 'bandpass', Window);
% Calculated Group Delay: 5.5 samples
% Calculated Phase Delay: 5.5 samples
First Sample Signal & Filtration
% Sample Signal
t = linspace(-2.*pi,2.*pi,12);
rng default;
% initialize random number generator
x = sin(t) + 0.25*rand(size(t));
y = filter(Filter,1,x);
plot(t,x);
hold on;
plot(t,y);
legend('Input Data', 'Filtered Data');
Second Sample Signal & Filtration
% Another Example
% chirp “Y” signal for better
visualization
load chirp
t = (0:length(y)-1)/Fs;
x = filter(Filter,1,y);
plot(t,y);
hold on;
plot(t,x);
legend('Input Data', 'Filtered Data');
Reference
 [1] Wikipedia- The Free Encyclopedia [www.Wikipedia.org]
 [2] Mathworks India- MATLAB Documentation [in.mathworks.com]
 [3] Scipy Cookbook- SciPy Python Documentation [scipy-
cookbook.readthedocs.io]
 [4] University of Colorado Colorado Springs Open Education Library
 [5] Digital Signal Processing- Pearson Publication- Fourth Edition by John J.
Proakis & Dimitris G. Manolakis
Thank You

Finite Impulse Response Band Pass Filter

  • 1.
    Finite Impulse Response BandPass Filter MATLAB IMPLEMENTATION
  • 2.
    Band Pass Filter[ BPF ] Aband-pass filter or BPF, is a device that passes frequencies within a certain range and rejects frequencies outside that range. These filters can also be created by combining a low-pass filter with a high-pass filter. An ideal band-pass filter would have a completely flat passband (e.g. with no gain/attenuation throughout) and would completely attenuate all frequencies outside the passband. Additionally, the transition out of the passband would have brickwall characteristics. In practice, no band-pass filter is ideal. The filter does not attenuate all frequencies outside the desired frequency range completely; in particular, there is a region just outside the intended passband where frequencies are attenuated, but not rejected.
  • 3.
    Finite Impulse Response[ FIR ] In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying). A direct form discrete-time FIR filter of order N. The top part is an N-stage delay line with N + 1 taps. Each unit delay is a Z- inverse operator in Z-transform notation.
  • 4.
    Problem Statement Design aBand-Pass Linear Phase FIR Filter of Order 11 having pass band from 4kHz to 6kHz using MATLAB. Take sampling rate of 18kHz for it’s implementation. Plot “Frequency Response” of the filter.  To design an FIR filter, we used Kaiser Window of order 11
  • 5.
    Initialization ``` % Sampling Frequency Fs=18000; % Band Limit 4kHz - 6 kHz Passband= [4000 6000]; % Magnitude for Passband and Stopband Magnitudes= [1 0]; % Passband Ripple and Stopband Ripple Deviations= [0.04 0.01]; ``` Kaiser Order For Kaiser Window, we need a beta (ɞ) value. Which will be used for Bessel function I˳(ɞ). Instead of taking arbitrary value of beta, we used “Kaiser Order Function” to determine it’s value. ``` [N, Wn, beta, ftype]= kaiserord(Passband, Magnitudes, Deviations, Fs); ```
  • 6.
    Window Preparation % Sincewe've to create 11 order FIR BPF % Suggested Beta: 3.3953 n= 11; Window= kaiser(n+1, beta);
  • 7.
    Filter Preparation % SuitableFrequency Constraints for FIR filter wn=[Passband(1) Passband(2)]/(Fs/2); Filter= fir1(n, wn, 'bandpass', Window); % Calculated Group Delay: 5.5 samples % Calculated Phase Delay: 5.5 samples
  • 8.
    First Sample Signal& Filtration % Sample Signal t = linspace(-2.*pi,2.*pi,12); rng default; % initialize random number generator x = sin(t) + 0.25*rand(size(t)); y = filter(Filter,1,x); plot(t,x); hold on; plot(t,y); legend('Input Data', 'Filtered Data');
  • 9.
    Second Sample Signal& Filtration % Another Example % chirp “Y” signal for better visualization load chirp t = (0:length(y)-1)/Fs; x = filter(Filter,1,y); plot(t,y); hold on; plot(t,x); legend('Input Data', 'Filtered Data');
  • 10.
    Reference  [1] Wikipedia-The Free Encyclopedia [www.Wikipedia.org]  [2] Mathworks India- MATLAB Documentation [in.mathworks.com]  [3] Scipy Cookbook- SciPy Python Documentation [scipy- cookbook.readthedocs.io]  [4] University of Colorado Colorado Springs Open Education Library  [5] Digital Signal Processing- Pearson Publication- Fourth Edition by John J. Proakis & Dimitris G. Manolakis
  • 11.