# INVFREQZ

## Purpose:

Computes digital filter coefficients from a complex frequency response.

## Syntax:

INVFREQZ(h, w, N, M, wf, maxiter, tol)

(b, a) = INVFREQZ(h, w, N, M, wf, maxiter, tol)

 h - A series. The desired complex frequency response. w - A series. The normalized frequency samples in radians/s where 0 <= w <= π and length(w) == length(h). N - An integer. The order of the numerator polynomial. M - An integer. The order of the denominator polynomial. wf - Optional. A series, the weight at each frequency sample. Can be empty or a series with the same length as h where wf > 0. Defaults to a series of all ones (i.e. unity weighting). maxiter - Optional. An integer, the maximum number of iterations for the Gauss-Newton minimization option. Defaults to 30 if specified as empty. tol - Optional. A real, the tolerance of the gradient norm for the iteration step. Defaults to 0.01 if specified as empty.

## Alternate Syntax:

INVFREQZ(h, w, "complex", N, M, wf, maxiter, tol)

(b, a) = INVFREQZ(h, w, "complex", N, M, wf, maxiter, tol)

 h - A series. The desired complex frequency response. w - A series. The normalized frequency samples in radians/s where -π <= w <= π and length(w) == length(h). "complex" - A string, Specifies that complex filter coefficients will be computed. N - An integer. The order of the numerator polynomial. M - An integer. The order of the denominator polynomial. wf - Optional. A series, the weight at each frequency sample. Can be empty or a series with the same length as h where wf > 0. Defaults to a series of all ones (i.e. unity weighting). maxiter - Optional. An integer, the maximum number of iterations for the Gauss-Newton minimization option. Defaults to 30 if specified as empty. tol - Optional. A real, the tolerance of the gradient norm for the iteration step. Defaults to 0.01 if specified as empty.

## Returns:

A two column series where the values of column 1 are the numerator coefficients and the values of column 2 are the denominator coefficients.

(b, a) = INVFREQZ(h, w, nb, na, maxiter, tol) returns the numerator and denominator coefficients as two separate series.

If "complex" is specified, complex coefficients are returned.

## Example:

b = {1, 2, 3, 2, 3}

a = {1, 2, 3, 2, 1, 4}

(h, w) = freqz(b, a, 64);

(b1, a1) = invfreqz(h, w, 4, 5)

b1 == {1, 2, 3, 2, 3}

a1 == {1, 2, 3, 2, 1, 4}

The variables h and w contain the complex frequency response and frequency values of the system to model. Although INVFREQZ computes the filter coefficients that match the original values, because the denominator contains poles outside the unit circle, the system is unstable.

## Example:

(b2, a2) = invfreqz(h, w, 4, 5, {}, 20)

b2 == {0.249368, 0.301802, -0.001658, 0.063888, 0.121041}

a2 == {1.000000, -0.794051, 0.575584, 0.903462, -0.697508, 0.479046}

By specifying an iteration value, INVFREQZ computes the filter coefficients using the Gauss-Newton minimization method. The computed system is stable (all denominator poles are in the left half plane).

## Remarks:

INVFREQZ computes digital filter coefficients given a complex frequency response and normalized frequency values for the following discrete system: where z = e jω, the complex frequency. The parameters N and M determine the order of the numerator and denominator polynomials such that N+1 and M+1 coefficients will be returned.

If maxiter is not specified, the coefficients are computed by minimizing: If maxiter is specified as empty or an integer, the coefficients are computed using the Gauss-Newton method to minimize: The input frequencies, ω, are specified in radians/seconds such that ω = 2πf, where f is frequency in Hertz.

If "complex" is not specified, real coefficients are computed. In this case, the normalized frequency values must range from 0 to π and the response of the filter at negative frequencies is automatically set to conj(h) to maintain proper symmetry.

If "complex" is specified, complex filter coefficients are computed and the normalized frequency samples can range from -π to π and no frequency domain symmetry is enforced.

The first coefficient of a, the denominator polynomial, is 1.0.

See INVFREQS to compute analog filter coefficients from a complex frequency response.

FILTEQ

FREQS

FREQZ

GIMPULSE

GRPDELAY

IMPZ

INVFREQS

RESIDUEZ

SFREQ

ZFREQ

ZPFCOEF