PZMAP

A pole-zero map summarizes the dynamic structure of a linear system by listing the locations of its poles and zeros in the complex plane.

Poles are the roots of the denominator polynomial and zeros are the roots of the numerator polynomial:

D(s) = 0 \quad \text{for poles}, \qquad N(s) = 0 \quad \text{for zeros}

Their locations help explain transient behavior, resonance, and stability. This wrapper returns a rectangular 2D array containing pole real parts, pole imaginary parts, zero real parts, and zero imaginary parts, padded with blank cells when the number of poles and zeros differs.

Excel Usage

=PZMAP(sysdata)
  • sysdata (list[list], required): System data (numerator, denominator rows).

Returns (list[list]): A 4-row array: [P_Real, P_Imag, Z_Real, Z_Imag].

Example 1: PZ Map

Inputs:

sysdata
1 2
1 2

Excel formula:

=PZMAP({1,2;1,2,5})

Expected output:

Result
-1 -1
2 -2
-2
0

Python Code

Show Code
import control as ct
import numpy as np

def pzmap(sysdata):
    """
    Compute the poles and zeros of a linear system.

    See: https://python-control.readthedocs.io/en/latest/generated/control.pzmap.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 4-row array: [P_Real, P_Imag, Z_Real, Z_Imag].
    """
    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)
        pz = ct.pole_zero_map(sys)
        poles = np.asarray(pz.poles)
        zeros = np.asarray(pz.zeros)

        p_re = [float(value) for value in np.real(poles)]
        p_im = [float(value) for value in np.imag(poles)]
        z_re = [float(value) for value in np.real(zeros)]
        z_im = [float(value) for value in np.imag(zeros)]
        ml = max(len(p_re), len(z_re), 1)
        def pad(l, n): return l + [""] * (n - len(l))
        return [pad(p_re, ml), pad(p_im, ml), pad(z_re, ml), pad(z_im, ml)]
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

System data (numerator, denominator rows).