# invfreqs

Compute analog filter coefficients from frequency response values.

## Syntax

[b,a] = invfreqs(h,f,nb,na)

[b,a] = invfreqs(h,f,nb,na,w)

## Inputs

`h`- The complex frequency response values.
`f`- The frequencies corresponding to
`h`(in radians/sec). `nb`- The filter numerator polynomial order.
`na`- The filter denominator polynomial order.
`w`- Optional weights applied to acheive a weighted fitting of the response values.

## Outputs

`b`- The estimated numerator polynomial coefficients of the filter.
`a`- The estimated denominator polynomial coefficients of the filter.

## Example

Recover coefficients from the output of an analog Chebyshev I filter.

```
order = 3;
wc = (2*pi)*100;
[b1,a1] = cheby1(order, 1, wc, 's')
w = [0:0.2:2] * wc;
h = freqs(b1,a1,w);
[b2,a2] = invfreqs(h,w,order,order)
```

```
b1 = [Matrix] 1 x 4
0.00000e+00 0.00000e+00 0.00000e+00 1.21869e+08
a1 = [Matrix] 1 x 4
1.00000e+00 6.20993e+02 4.88904e+05 1.21869e+08
b2 = [Matrix] 1 x 4
6.57632e-17 2.15327e-14 6.91457e-11 1.21869e+08
a2 = [Matrix] 1 x 4
1.00000e+00 6.20993e+02 4.88904e+05 1.21869e+08
```

## Comments

It is recommended to use freqs to assess the quality of the fitted filter coefficients.