Language Reference
DFSOSFREQZZPK Function
DFSOSFREQZZPK (z, p, k, <, N>) ;
The DFSOSFREQZZPK function generates the frequency response of a digital filter that corresponds to its second-order sections form by using the filter transfer function’s zeros, poles, and gain. It is easier to read the subroutine name when it is written in mixed case: DFSOSFreqzZPK.
The input arguments to the DFSOSFreqzZPK function are as follows:
- z
is a matrix that contains the zeros of the digital filter’s transfer function. It can be a two-column matrix or a two-row matrix. When z is a two-row matrix, each column represents one zero value whose real part is in the first row and whose imaginary part is in the second row. When z is a two-column matrix, each row represents one zero value, which is a complex number whose real part is in the first column and whose imaginary part is in the second column. If z is a matrix, each column represents one zero value.
- p
is a matrix that contains the poles of the digital filter’s transfer function. It can be a two-column matrix or a two-row matrix. When p is a two-row matrix, each column represents one pole value whose real part is in the first row and whose imaginary part is in the second row. When p is a two-column matrix, each row represents one pole value, which is a complex number whose real part is in the first column and whose imaginary part is in the second column. If p is a matrix, each column represents one pole value.
- k
is a scalar that specifies the gain of the digital filter’s transfer function.
- N
is a positive integer that specifies the number of evaluation points for the frequency response. N must be greater than 1 and greater than the filter’s order. N is an optional input argument. If it is not specified, a value of 512 is used.
The DFSOSFreqzZPK function returns a three-column matrix. The number of rows of this matrix is the input parameter N. The first two columns are the complex frequency response, whose real part is in the first column and whose imaginary part is in the second column. The third column contains the angular frequencies at which the frequency response is evaluated. The range of the angular frequencies is from 0 to .
The following example uses the DFSOSFreqzZPK function to generate the frequency response of a bandstop filter that corresponds to its second-order sections form by using the filter transfer function’s zeros, poles, and gain:
filter_name = "butter";
filter_type = "bandstop";
n = 7;
Wc = 0.2 || 0.8;
call dfdesign(b, a, z, p, k, filter_name, filter_type, n, Wc);
N = 1024;
h = DFSOSFreqzZPK(z, p, k, N);
w = h[,3] / constant('pi');
logh = 20*log10(sqrt(h[,1]#h[,1]+h[,2]#h[,2]) + 1e-16);
/* a small constant is added to avoid the input to log10() is 0 */
w = h[,3] / constant('pi');
logh = 20*log10(sqrt(h[,1]##2+h[,2]##2) + 1e-16);
/* a small constant is added to avoid the input to log10() is 0 */
title "Frequency Response of a Bandstop Filter";
call series(w,logh) grid= {X Y}
label={"Normalized Frequency ((*ESC*){unicode pi} rad/sample)" "Magnitude (dB)"};
Figure 25.120: Frequency Response Using Filter Transfer Function’s Zeros, Poles, and Gain
