Digital Signal Processing Reference
In-Depth Information
Once the required filter coefficients,
h
(
n
), 0
N
, are obtained, a
coefficient file,
lowpass.cof
is created as shown below.
≤
n
≤
/*lowpass.cof FIR lowpass filter coefficients file*/
#define N 51 /*length of filter*/
short hlp[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)
};
•
High pass filter
Design a digital
high-pass
filter, having a cutoff frequency of 1.5 kHz,
using the program below.
% MATLAB Program to Calculate the FIR High-Pass Filter
Coefficients
N = 50 ; specifies the filter order (50)
fs = 8000 ; specifies the sampling frequency
(8 KHz)
f = 1500 ; specifies the analog filter
cutoff frequency in Hz.
wn=2*pi*f/fs ; transforms the analog cutoff
frequency,
f
Hz, to
; digital cutoff frequency,
w
n
,
rad.
wn=wn/pi ; normalizes the digital cutoff
frequency vector
h = fir1(N,wn,'high') ; calculates the FIR high-pass
filter coefficients
Once the required filter coefficients,
h
(
n
), 0
N
, are obtained, a
coefficient file,
high pass.cof
is created as shown below:
≤
n
≤