Function freqz #
Calculates the frequency response of a filter given its numerator and denominator coefficients.
Syntax #
math.freqz(b, a)
math.freqz(b, a, w)
Parameters #
Parameter | Type | Description |
---|---|---|
b |
Array.<number> | The numerator coefficients of the filter. |
a |
Array.<number> | The denominator coefficients of the filter. |
w |
Array.<number> | A vector of frequencies (in radians/sample) at which the frequency response is to be computed or the number of points to compute (if a number is not provided, the default is 512 points) |
Returns #
Type | Description |
---|---|
Object | An object with two properties: h, a vector containing the complex frequency response, and w, a vector containing the normalized frequencies (in radians/sample) at which the response was computed. |
Throws #
Type | Description —- | ———–
Examples #
math.freqz([1, 2], [1, 2, 3], 4) // returns { h: [0.5 + 0i, 0.4768589245763655 + 0.2861153547458193i, 0.25000000000000006 + 0.75i, -0.770976571635189 + 0.4625859429811135i], w: [0, 0.7853981633974483, 1.5707963267948966, 2.356194490192345 ] }
math.freqz([1, 2], [1, 2, 3], [0, 1]) // returns { h: [0.5 + 0i, 0.45436781 + 0.38598051i], w: [0, 1] }