Engee documentation

tf2zpk

Conversion of the transfer function filter parameters into the form of zeros, poles, and gain.

Library

EngeeDSP

Syntax

Function call

  • z,p,k = tf2zpk(b,a) — finds a vector of zeros z, the vector of poles p and the corresponding gain factor k from the parameters of the transfer function b and a. The function transforms the polynomial representation of the transfer function

    a discrete system with one input and one output (Single-Input/Single-Output, SISO) into a multiplier form of the transfer function

    Use the function tf2zpk when working with transfer functions expressed in degrees . A similar function tf2zp it 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 .

Типы данных

Float32, Float64

# 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 .

Типы данных

Float32, Float64

Output arguments

# z — zeros of the system

+ vector

Details

The zeros of the system returned as a column vector.

# p — poles of the system

+ vector

Details

The poles of the system, returned as a column vector.

# k is the system gain factor

+ scalar

Details

The system’s gain, returned as a scalar.

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!())

tf2zpk