Signal Processing Toolbox | Help Desk |
invfreqz
Discrete-time filter identification from frequency data.
[b,a] = invfreqz(h,w,nb,na) [b,a] = invfreqz(h,w,nb,na,wt) [b,a] = invfreqz(h,w,nb,na,wt,iter) [b,a] = invfreqz(h,w,nb,na,wt,iter,tol) [b,a] = invfreqz(h,w,nb,na,wt,iter,tol,'trace')
invfreqz
is the inverse operation of freqz
; it finds a discrete-time transfer function that corresponds to a given complex frequency response. From a laboratory analysis standpoint, invfreqz
can be used to convert magnitude and phase data into transfer functions.
[b,a] = invfreqz(h,w,nb,na)
returns the real numerator and denominator coefficients in vectors b
and a
of the transfer functionh
at the frequency points specified in vector w
. Scalars nb
and na
specify the desired orders of the numerator and denominator polynomials.
Frequency is specified in radians between 0 and h
must be the same as the length of w
.
[b,a] = invfreqz(h,w,nb,na,wt)
weights the fit-errors versus frequency. wt
is a vector of weighting factors the same length as w
.
invfreqz(h,w,nb,na,wt,iter)
and
invfreqz(h,w,nb,na,wt,iter,tol)
provide a superior algorithm that guarantees stability of the resulting linear system and searches for the best fit using a numerical, iterative scheme. The iter
parameter tells invfreqz
to end the iteration when the solution has converged, or after iter
iterations, whichever comes first. invfreqz
defines convergence as occuring when the norm of the (modified) gradient vector is less than tol
. tol
is an optional parameter that defaults to 0.01. To obtain a weight vector of all ones, use
invfreqz(h,w,nb,na,[],iter,tol)
invfreqz(h,w,nb,na,wt,iter,tol,'trace')
displays a textual progress report of the iteration.
Convert a simple transfer function to frequency response data and then back to the original filter coefficients:
a = [1 2 3 2 1 4]; b = [1 2 3 2 3]; [h,w] = freqz(b,a,64); [bb,aa] = invfreqz(h,w,4,5) bb = 1.0000 2.0000 3.0000 2.0000 3.0000 aa = 1.0000 2.0000 3.0000 2.0000 1.0000 4.0000Notice that
bb
and aa
are equivalent to b
and a
, respectively. However, aa
has poles outside the unit circle and thus the system is unstable. Use invfreqz
's iterative algorithm to find a stable approximation to the system:
[bbb,aaa] = invfreqz(h,w,4,5,[],30) bbb = 0.2427 0.2788 0.0069 0.0971 0.1980 aaa = 1.0000 -0.8944 0.6954 0.9997 -0.8933 0.6949By default,
invfreqz
uses an equation error method to identify the best model from the data. This finds b
and a
in\
operator. Here A(w(k)) and B(w(k)) are the Fourier transforms of the polynomials a
and b
, respectively, at the frequency w(k), and n is the number of frequency points (the length of h
and w
). This algorithm is a based on Levi [1].
The superior ("output-error") algorithm uses the damped Gauss-Newton method for iterative search [2], with the output of the first algorithm as the initial estimate. This solves the direct problem of minimizing the weighted sum of the squared error between the actual and the desired frequency response pointsContinuous-time (analog) filter identification from frequency data. |
|