ZEROS
The zeros of a linear time-invariant system are the roots of the numerator polynomial of its transfer function.
If the numerator is written as
b_m s^m + b_{m-1} s^{m-1} + \cdots + b_1 s + b_0 = 0
then the zeros are the complex values of s that satisfy this equation. Zeros influence transient shape, frequency response, and cancellation behavior. This wrapper returns the real and imaginary parts of the zeros as a 2-row array.
Excel Usage
=ZEROS(sysdata)
sysdata(list[list], required): System data (numerator, denominator rows).
Returns (list[list]): A 2-row array: [Real, Imaginary].
Example 1: System zeros
Inputs:
| sysdata | |
|---|---|
| 1 | 1 |
| 1 | 2 |
Excel formula:
=ZEROS({1,1;1,2,1})
Expected output:
| Result |
|---|
| -1 |
| 0 |
Python Code
Show Code
import control as ct
import numpy as np
def zeros(sysdata):
"""
Compute the zeros of a linear system.
See: https://python-control.readthedocs.io/en/latest/generated/control.zeros.html
This example function is provided as-is without any representation of accuracy.
Args:
sysdata (list[list]): System data (numerator, denominator rows).
Returns:
list[list]: A 2-row array: [Real, Imaginary].
"""
try:
def flatten(x):
if x is None: return None
if not isinstance(x, list): return [float(x)]
res = []
for row in x:
if isinstance(row, list):
for v in row:
if v is not None and str(v).strip() != "":
res.append(float(v))
elif row is not None and str(row).strip() != "":
res.append(float(row))
return res if res else None
if not sysdata or len(sysdata) < 2:
return "Error: sysdata must contain numerator and denominator rows"
num = flatten(sysdata[0])
den = flatten(sysdata[1])
if not num or not den:
return "Error: Invalid numerator or denominator arrays"
sys = ct.tf(num, den)
z = ct.zeros(sys)
if len(z) == 0:
return [[""], [""]]
return [
[float(value) for value in np.real(z)],
[float(value) for value in np.imag(z)],
]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
System data (numerator, denominator rows).