fir1
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
Create and/or apply a FIR filter.
- Usage 1
fir1(f1, f2 , m)
- f1, f2
- the lower and upper cutoff frequency; both values must be specified as relative frequencies (f / sampling-rate); 0 ≤ f1 < f2 ≤ 0.5
- m
- the number of filter taps
- Result
- The function computes the FIR coefficients for the filter defined by the arguments and returns a vector c with 2m+1 elements. The result c can be used to apply the filter to a signal (see Usage 3).
- Usage 2
fir1(f1, f2, m, x)
- f1, f2, m
- see Usage 1
- x
- a vector containing the source signal
- Result
- The function computes the filter coefficients for the FIR defined by the arguments and applies it to the signal x. The result has the same type as the input signal x and containes the filtered signal.
- Usage 3
fir1(c, z, x{, s})
- c
- FIR filter coefficients (see Usage 1)
- z
- the filter state (delay); must be a vector with the same length as c
- notes:
- The vector should be initialized with zeros (e.g.:
#z := eval fill($#c[!nrow],0,0)
) - The values of z are changed (z must be a reference to a table item)
- The vector should be initialized with zeros (e.g.:
- x
- the signal sample (scalar) or the signal vector to be filtered
- s
- the downsampling factor; must be an integer in the range
0<s<ncol(x)
(default=1) - note:
- If s>1, only the filter output values y[0], y[s], y[2s], ... are stored in the result.
- If s>1,
nrow(x)
should be a multiple of s.
- Result
- The filtered signal (sample or vector). The argument (reference) z is updated with the new filter state.
- See also
- iir1