<< inv_residue | FOSSEE_Signal_Processing_Toolbox | invfreqs >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > invfreq

# invfreq

Fit filter B(z)/A(z) or B(s)/A(s) to complex frequency response at frequency points F.

### Syntax

    [B, A] = invfreq(H, F, nB, nA)
    [B, A] = invfreq(H, F, nB, nA, W)
    [B, A] = invfreq(H, F, nB, nA, W, [], [], plane)
    [B, A] = invfreq(H, F, nB, nA, W, iter, tol, plane)

### Parameters

H:

  Desired complex frequency response. It is assumed that A and B are real polynomials, hence H is one-sided.

F:

  Vector of frequency samples in radians.

nA:

  Order of denominator polynomial A.

nB:

  Order of numerator polynomial B.

W:

  (optional) Vector of weights for frequency samples. Default is uniform weighting.

iter:

  (optional) Number of Steiglitz-McBride iterations. Default is no iterations.

tol:

  (optional) Tolerance for Steiglitz-McBride iterations. Default is no tolerance.

plane:

  (optional) Transform plane. Either "z" for discrete-time spectra (default) or "s" for continuous-time spectra.

B:

  Coefficients of the numerator polynomial.

A:

  Coefficients of the denominator polynomial.

### Description

The `invfreq` function fits a rational transfer function B(z)/A(z) or B(s)/A(s) to the desired complex frequency response `H` at frequency points `F`. The orders of the numerator and denominator polynomials are specified by `nB` and `nA`, respectively. Optionally, the fit-errors can be weighted using the weights `W`. The transform plane can be specified as either "z" for discrete-time or "s" for continuous-time. By default, the z-plane is used.

The function supports Steiglitz-McBride iterations for iterative refinement of the solution, specified by `iter` and `tol`.

### Examples

    // Fit a filter to a Butterworth filter response:
    order=6
    fc = 1/2
    n = 128
    [B, A] = butter(order, fc)
    [H, w] = freqz(B, A, n)
    [Bh, Ah] = invfreq(H, w, order, order)
    [Hh,wh] = freqz(Bh, Ah,n)
    disp(sprintf('||frequency response error||= %f', norm(H - Hh)));

### Bibliography

J. O. Smith, "Techniques for Digital Filter Design and System Identification with Application to the Violin, Ph.D. Dissertation, Elec. Eng. Dept., Stanford University, June 1983, page 50.

http://ccrma.stanford.edu/~jos/filters/FFT_Based_Equation_Error_Method.html

### Authors

- FOSSEE Team
- toolbox@scilab.in

Report an issue
<< inv_residue | FOSSEE_Signal_Processing_Toolbox | invfreqs >>