Digital Signal Processing Reference
In-Depth Information
/*highpass.cof FIR highpass filter coefficients file*/
#define N 51 /*length of filter*/
short hhp[N]=
{ h(0),h(1),………………………h(10),
h(11),h(12),………………………h(20),
h(21), h(22), ………………………h(30),
h(31), h(32), ………………………h(40),
h(41), h(32), ………………………h(50)
};
Bandpass filter
Design a digital bandpass 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-
pass filter are 1.4 kHz and 1.6 kHz, respectively.
% Program to Calculate the FIR Bandpass 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) ; calculates the FIR bandpass filter
coefficients
Once the required filter coefficients, h ( n ), 0
N , are obtained, a
coefficient file, bandpass.cof is created as shown below.
n
/*bandpass.cof FIR bandpass filter coefficients file*/
#define N 51 /*length of filter*/
short hbp[N]=
{ h(0),h(1),………………………h(10),
 
Search WWH ::




Custom Search