|
Calling Sequence
|
|
FilterFrequencyResponse( A, options )
FilterFrequencyResponse( A, B, options )
|
|
Parameters
|
|
A
|
-
|
1-D rtable or list of numeric values for the coefficients of the numerator of the transfer function.
|
B
|
-
|
(optional) 1-D rtable or list of numeric values for the coefficients of the denominator of the transfer function. The default is NULL.
|
|
|
|
|
Options
|
|
•
|
fftnormalization: (optional) One of none, symmetric, or full, indicates the normalization to be applied when using the Fast Fourier Transform (FFT). The default is symmetric.
|
•
|
magnitudeplotoptions: (optional) Additional plot options to be passed when creating the plot of the magnitudes. The default is [].
|
•
|
phaseplotoptions: (optional) Additional plot options to be passed when creating the plot of the phases. The default is [].
|
•
|
phaseunit: (optional) Specifies the unit of angle for the phases. The default is Unit(degrees). Either of the forms algebraic or Unit(algebraic) is accepted, and the unit must be convertible to a valid unit of angle.
|
•
|
samplerate: (optional) Positive numeric value for the sampling rate. The default is NULL.
|
•
|
size: (optional) Positive integer larger than 1, which specifies the computed size of the response, magnitudes, and phases Vectors. The default is the smallest power of 2 that is greater than or equal to all of 512, numelems(A), and (if passed) numelems(B).
|
•
|
output: (optional) The type of output. The supported options are:
|
–
|
frequencies: Returns a Vector, of float[8] datatype and length size, containing the frequencies.
|
–
|
magnitudes: Returns a Vector of float[8] datatype and length size containing the magnitudes.
|
–
|
phases: Returns a Vector of float[8] datatype and length size containing the phases.
|
–
|
response: Returns a Vector of complex[8] datatype and length size containing the response. This is the default.
|
–
|
magnitudeplot: Returns a plot of the magnitudes versus the frequencies.
|
–
|
phaseplot: Returns a plot of the phases versus the frequencies.
|
–
|
record: Returns a record with the previous options.
|
–
|
list of any of the above options: Returns an expression sequence with the corresponding outputs, in the same order.
|
|
|
Description
|
|
•
|
The FilterFrequencyResponse command computes the frequency response of the transfer function indicated by the taps stored in one or two rtables/lists of 1-D data.
|
•
|
The A container stores the coefficients of the numerator of the transfer function and, if passed, B stores the coefficients of the denominator. Each of the containers must contain one or more elements.
|
•
|
For the IIR (Infinite Impulse Response) case, the impulse transfer function in terms of the taps is given by the following:
|
|
where and . For the FIR (Finite Impulse Response) case:
|
•
|
Internally, the taps containers are padded with sufficiently many zeros, if necessary, so that the response will be of length size.
|
•
|
When only numerator taps are passed (FIR case), the response is the Fast Fourier Transform (FFT) of the padded taps container. When denominator taps are also passed (IIR case), the response is the element-wise quotient of the FFTs of the respective padded taps containers. When the taps are all real-valued, the padded length will be 2*size, and then the redundant (due to symmetry) second half of any FFT will be discarded. On the other hand, when one or more taps is complex, the padded length will be just size, and no terms will be discarded.
|
•
|
The magnitudes are first computed as the element-wise absolute values of the response. Then, they are converted to decibels via the transformation for the complex case, and for the real-case (the extra factor of 2 is due to the symmetry and discarding of the second half of the FFTs).
|
•
|
The phases are first computed as the element-wise angles/arguments of the response. Then, they are "unwrapped" to eliminate big jumps in the phases, and finally, if phaseunit=degrees, converted to angles (a common convention).
|
•
|
When samplerate=NULL, the frequencies Vector is of size and "normalized", with components defined by the following:
|
|
When is not NULL, on the other hand:
|
•
|
The samplerate option can include a unit, which will be included in the plots. Either of the forms algebraic or Unit(algebraic) is accepted, but the unit must be convertible to a valid unit of frequency.
|
•
|
Maple will attempt to coerce the provided taps to Vectors of complex[8] datatype, and an error will be thrown if this is not possible. For this reason, it is most efficient for the passed taps to use this datatype.
|
•
|
Input rtables cannot have an indexing function, and must use rectangular storage.
|
•
|
The FilterFrequencyResponse command is not thread safe.
|
|
|
Examples
|
|
>
|
|
|
Simple Examples
|
|
>
|
|
| (1) |
>
|
|
| (2) |
|
|
Real FIR Filter
|
|
•
|
First, generate some FIR taps using the GenerateFIRFilterTaps command:
|
>
|
|
| (3) |
•
|
Now, display plots of the magnitude and phase of the response:
|
>
|
|
|
|
IIR Filter
|
|
•
|
Here, we will obtain taps for a lowpass digital Chebyshev Type I Filter from the GenerateChebyshev1Taps command:
|
>
|
|
| (5) |
>
|
|
| (8) |
•
|
The first half of the Taps Vector are for the numerator, and the second half are for the denominator:
|
>
|
|
| (9) |
•
|
Now, we plot the magnitudes and phases of the response:
|
>
|
|
|
|
Complex FIR Filter
|
|
>
|
|
>
|
|
|
|
|
Compatibility
|
|
•
|
The SignalProcessing[FilterFrequencyResponse] command was introduced in Maple 2021.
|
|
|
|