Digital Signal Processing Reference
In-Depth Information
•
H
is the complex frequency response vector
•
w
is a vector containing the
p
frequency points in the range 0
≤
w
≤
π
radians.
•
a
and
b
are row vectors containing the coefficients
a
n
, n
= 0, 1, 2 …
N
and
b
n
, n
= 0, 1, 2 …
M
5.3.2
CAD of FIR Filters
Method I. Window-based FIR filter design I
>> b = fir1(N,wn,window); implements windowed low-pass
FIR filter design
•
b
is a row vector containing the
N
+ 1 coefficients of the order
N
lowpass linear phase FIR filter with cutoff frequency
w
n
. The filter
coefficients are ordered in descending shift order:
yn
()
=
bxn
()
+
bxn
(
−
1
)
+ …−
b xn M
M
(
)
0
1
•
) and is a
number between 0 and 1. If
w
n
, the cutoff frequency, is a 2-element
vector
w
n
= [
w
1
w
2
], then
fir1
returns a
bandpass filter
with passband
w
1
<
w
<
w
2
.
w
n
is the normalized cutoff frequency (normalized to
π
•
N
is the order of the filter.
•
Window
is a column vector containing
N
+ 1 elements of the specified
window function
w
(
n
). If no window is specified,
fir1
employs the
Hamming Window.
•
High-pass filters
are designed by including the string
high
as a final
argument.
>> b = fir1(N,wn,'high', window)
•
Bandstop filters
are designed by including the string
stop
as the final
argument and by specifying
w
n
as a 2-element vector
w
n
= [
w
1
w
2
].
>> b = fir1(N,wn,'stop', window)
Method II. Window-based FIR filter design II
>> b = fir2(N,f,H,window)
The
fir2
command designs digital filters with arbitrarily shaped response.
This is in contrast to
fir1
, which designs filters in only standard low-pass,
high-pass, bandpass, and bandstop configurations.