invfreqz
Compute digital filter coefficients from frequency response values.
Syntax
[b,a] = invfreqz(h,f,nb,na)
[b,a] = invfreqz(h,f,nb,na,w)
Inputs
- h
- The complex frequency response values.
- f
- The frequencies corresponding to h. The values in Hz must be normalized relative to fs/(2*pi), where fs is the sampling frequency, so that the Nyquist frequency corresponds to a value of pi.
- nb
- The filter numerator polynomial order.
- na
- The filter denominator polynomial order.
- w
- Optional weights applied to achieve 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 a digital Chebyshev I filter.
order = 3;
fc = 200;
fs = 1000;
[b1,a1] = cheby1(order, 1, fc/(fs/2), 'z')
f = [0:0.2:2] * fc;
h = freqz(b1,a1,f,fs);
[b2,a2] = invfreqz(h,pi*f/(fs/2),order,order)
b1 = [Matrix] 1 x 4
0.07360 0.22079 0.22079 0.07360
a1 = [Matrix] 1 x 4
1.00000 -0.97613 0.85676 -0.29186
b2 = [Matrix] 1 x 4
0.07360 0.22079 0.22079 0.07360
a2 = [Matrix] 1 x 4
1.00000 -0.97613 0.85676 -0.29186
Comments
It is recommended to use freqz to assess the quality of the fitted filter coefficients.