Generates filter coefficients for a digital FIR filter. |
||
Syntax |
Num = Fir(Order,Fc,Window) Num = Fir(Order,Fc,Band,Window) Num = Fir(Order,Fc1,Fc2,Window) |
|
Arguments |
Name |
Description |
Order |
A positive integer specifying the order of the filter. For high pass and band stop filter, the order must be even. |
|
Fc |
The corner frequency in Hz of a low pass or high pass filter, or a vector of two corner frequencies for a band pass or band stop filter. For a digital filter, Fc is normalized by the Nyquist frequency and has values in the interval (0,1). For an analog filter, Fc has positive value(s). |
|
Band (optional) |
The filter band specifier. When Fc is a value, Band can be either ‘low’ (default) or ‘high.’ When Fc is a vector, Band is omitted for a band pass filter and ‘stop’ for a band stop filter. |
|
Window (optional) |
A vector of length Order + 1 for windowing the impulse response. The default is a rectangular window. |
|
Fc1, Fc2 |
For the Templex™ style convention, Fc1 and Fc2 are the normalized corner frequencies in Hz of a digital filter. For a low pass filter, Fc1 = 0. For a high pass filter, Fc2 = 0 or 1. For a band pass filter, Fc1 < Fc2. For a band stop filter, Fc1 > Fc2. |
|
Output |
Name |
Description |
Num |
Vector of numerator coefficients in descending power of z. Its length is one more than the filter order. |
|
Example 1 |
A low-pass second order digital Fir filter with a cut-off frequency at 250 Hz, where the data sampling frequency is 1000 Hz. Use the default window. |
|
Syntax |
||
b = Fir(2,0,250/500) |
||
Result |
||
b = 0.2800 0.4399 0.2800 |
||
Example 2 |
A band-pass second order digital FIR filter with low cut-off and high cut-off frequencies of 150Hz and 300Hz, respectively, where the data sampling frequency is 1000Hz. Use the default window. |
|
Syntax |
||
b = Fir(2,150/500,300/500) |
||
Result |
||
b = 0.1439 0.9550 0.1439 |
||
Comments |
For digital filters, the Nyquist frequency is half the sampling frequency. All frequency arguments are to be normalized with this value. |
|
See Also: |