Time Response of Digital Filters |
response(v, C1, n) Returns a n-element vector giving the
response of input vector v to an FIR or IIR filter with
coefficient array C1. Uses direct evaluation of the convolution.
For a long input signal, this method can be quite slow.
fftfilt(v, C2, [nfft]) Returns a vector giving the response
of input vector v to an FIR filter with coefficients C2.
Applies the DFT of optional length nfft to successive
segments of the input, then combines the results with the overlap-add method.
For the case of an FIR filter with an impulse response much shorter than the
input signal, this may be faster than the response function.
Arguments:
- v is a real or complex-valued signal vector or multichannel
matrix, filtered individually by column.
- C1 is a real or complex-valued vector (FIR) or 2-column
matrix (IIR) of filter coefficients. In the case of an IIR filter, the first
column contains coefficients of the numerator, the second contains coefficients
of the denominator. IIR transfer functions must be normalized so that the
constant term in the denominator is 1.
- C2 is a real or complex-valued vector of FIR filter
coefficients.
- n is a positive integer, the size of the output
vector, no greater than the length of the input.
- nfft (optional) is a positive integer, the length
of the FFT in the overlap-add method. It may not be greater than the length
of the signal. If omitted, nfft is the length of
the filter.
Notes:
-
If the final transient response is desired, zero pad the input signal to
the appropriate length, and then increase n.
-
For an IIR filter, response must always be used. For
an FIR filter with an impulse response much shorter than the input signal,
fftfilt may be used, and often provides a faster result.
- If nfft > length(x) + length(C) - 1, then fftfilt
does not use the overlap-add method. Instead it convolves the signal and filter
in one step in the Fourier domain, after zero-padding the signal and filter
vectors so that they are the length of nfft.