iir1, iir2
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
Initialize and/or apply an IIR filter.
- Usage 1
iir1(f1, f2 {, m, rp, rs, inv, type})
- 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 filter order (default=5)
- rp
- the desired passband ripple in dB; 0 < rp (default=0.5)
- rs
- the desired stopband damping level in dB; 0 < rs (default=40)
- inv
- invert filter response (0=no, 1=yes); if this value is set to 1, the filter frequency response is inverted and f1/f2 are the boundaries of the stopband
type: the type of the filter
- {class=keinrahmen"
|type=1 ||... Butterworth filter |type=2 ||... Chebyshev filter |type=3 ||... elliptic filter (this is the default)
- Result
- The function computes the filter coefficients for the IIR defined by the arguments and returns a matrix c with 2 columns. The first column (c[*,0]) contains the denominator coefficients (poles) and the second (c[*,1]) the nominator coefficients (zeros). The matrix c can be used to apply the filter to a signal (see Usage 3).
- Usage 2
iir1(f1, f2, m, rp, rs, inv, type, x)
- f1, f2, m, rp, rs, inv, type
- see Usage 1
- x
- a vector containing the source signal
- Result
- The function computes the filter coefficients for the IIR 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:
iir1(c, z, x{, s})
- c
- IIR filter coefficients (see Usage 1)
- z
- the filter state (delay); must be a matrix with the same dimensions as c
- note: The matrix should be initialized with zeros (e.g.:
#z := eval init($#c[!nrow],$#c[!ncol],0)
)- x
- the signal sample (scalar) or the signal vector to be filtered
- See also