Digital Signal Processing Reference
In-Depth Information
h(11),h(12),………………………h(20),
h(21), h(22), ………………………h(30),
h(31), h(32), ………………………h(40),
h(41), h(32), ………………………h(50)
};
•
Bandstop filter
Design a digital
bandstop
filter, having a
center
frequency of 1.5 kHz
and bandwidth of 200 Hz, using the program below. Because the
bandwidth of the filter is 200 Hz, the cutoff frequencies of the band-
stop filter are 1.4 kHz and 1.6 kHz, respectively.
% Program to Calculate the FIR Bandstop Filter
Coefficients
N = 50 ; specifies the filter order (50)
fs = 8000 ; specifies the sampling frequency
(8 KHz)
f =[1400 1600] ; specifies the analog filter
cutoff frequency vector in Hz.
wn = 2*pi*f/fs ; transforms the analog cutoff
frequency vector,
f
Hz, to
; digital cutoff frequency vector,
w
n
, rad.
wn = wn/pi ; normalizes the digital cutoff
frequency vector
h = fir1(N,wn,'stop') ; calculates the Fir bandstop
filter coefficients
Once the required filter coefficients,
h
(
n
), 0
N
, are obtained, a
coefficient file,
bandstop.cof
is created as shown below.
≤
n
≤
/*bandstop.cof FIR bandstop filter coefficients file*/
#define N 51 /*length of filter*/
short hbs[N]=
{ h(0),h(1),………………………h(10),
h(11),h(12),………………………h(20),
h(21), h(22), ………………………h(30),