tf2zpk
Conversion of the transfer function filter parameters into the form of zeros, poles, and gain.
| Library |
|
Syntax
Function call
-
z,p,k = tf2zpk(b,a)— finds a vector of zerosz, the vector of polespand the corresponding gain factorkfrom the parameters of the transfer functionbanda. The function transforms the polynomial representation of the transfer functiona discrete system with one input and one output (Single-Input/Single-Output, SISO) into a multiplier form of the transfer function
Use the function tf2zpkwhen working with transfer functions expressed in degrees . A similar functiontf2zpit is more useful when working with degrees. for example, in continuous transfer functions.
Arguments
Input arguments
# b — coefficients of the numerator of the transfer function
+
vector
Details
The coefficients of the numerator of the transfer function, specified as a vector. Argument b contains coefficients in ascending order of degrees .
| Типы данных |
|
# a — coefficients of the denominator of the transfer function
+
vector
Details
The coefficients of the denominator of the transfer function, specified as a vector. Argument a contains coefficients in ascending order of degrees .
| Типы данных |
|
Examples
Poles, zeros, and IIR filter gain
Details
Let’s design a Butterworth filter 3-th order with a normalized cutoff frequency rad/countdown. We will find the poles, zeros and the gain of the filter.
import EngeeDSP.Functions: butter, tf2zpk
b, a = butter(3, 0.4)
z, p, k = tf2zpk(b, a)
println("z = ", z, "\np = ", p, "\nk = ", k)
z = ComplexF64[-1.000006578089738 - 0.0im; -0.9999967109551287 + 5.6968468871119e-6im; -0.9999967109551287 - 5.6968468871119e-6im;;]
p = ComplexF64[0.20942804224088346 + 0.5581994780502226im; 0.20942804224088346 - 0.5581994780502226im; 0.1583844403245364 - 0.0im;;]
k = 0.098531160923927
Let’s plot the poles and zeros to make sure they are in the expected locations. Let’s add a unit circle to the graph for clarity.
import Pkg
Pkg.add("ControlSystems")
using ControlSystems
H = tf(vec(b), vec(a))
z, p = tzeros(H), poles(H)
pzmap(H)
annotate!([(real(zi)+0.1, imag(zi), text("Zero", 8)) for zi in z])
annotate!([(real(pi)+0.1, imag(pi), text("Pole", 8)) for pi in p])
θ = range(0, 2π, length=200)
plot!(cos.(θ), sin.(θ),
ls=:dash, color=:black,
xlabel="Real Part", ylabel="Imaginary Part",
label="Unit Circle", aspect_ratio=:equal)
display(plot!())