Engineering mode (cp.ee)¶
Linear systems, drawn with the same machinery. A TransferFunction is a plain callable, so every
renderer in the library accepts it — see engineering mode.
complexplorer.ee.TransferFunction ¶
A rational transfer function H = N/D from polynomial coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num
|
sequence of numbers
|
Numerator coefficients in |
required |
den
|
sequence of numbers
|
Denominator coefficients (same order). Must not be identically zero. |
required |
system
|
str
|
|
"s"
|
Examples:
>>> H = TransferFunction([1], [1, 2, 2]) # 1 / (s^2 + 2s + 2)
>>> H.is_stable
True
>>> import complexplorer as cp
>>> cp.plot(cp.Rectangle(6, 6), H)
is_stable
property
¶
Strict stability: all poles in the open left half-plane (s) / unit disk (z).
Marginal poles (on the boundary) count as unstable — the conservative convention.
frequency_response ¶
Evaluate H along the frequency contour.
s = jω for continuous systems, z = e^{jω} for discrete systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
array - like
|
Frequencies (rad/s or rad/sample). If omitted, a log-spaced grid is chosen
spanning a decade beyond the smallest and largest nonzero pole/zero magnitude
(fallback |
None
|
Returns:
| Type | Description |
|---|---|
(omega, response) : tuple of ndarray
|
The frequency grid and the complex response |
complexplorer.ee.transfer_portrait ¶
transfer_portrait(tf: TransferFunction, domain: Rectangle | None = None, resolution: int = 400, ax: Axes | None = None, title: str | None = None, **plot_kwargs)
Phase portrait of H with poles/zeros and the stability boundary overlaid.
Composes the standard 2D plot() path (so options like cmap= and legend=True
are honored). When no domain is given, a square domain enclosing all poles and zeros
(with margin) is used.
Returns the matplotlib axes.
complexplorer.ee.pole_zero_plot ¶
Pole-zero map: poles ×, zeros ○, stability boundary dashed.
Returns the matplotlib axes.
complexplorer.ee.bode_plot ¶
Bode plot: magnitude 20·log10|H| (dB) and phase (degrees) over log frequency.
Returns the matplotlib figure (two stacked panels sharing the frequency axis).
complexplorer.ee.nyquist_plot ¶
Nyquist plot: the locus of H along the frequency contour, −1 marked.
Positive frequencies are drawn solid; the mirrored negative-frequency branch dashed. Returns the matplotlib axes.
complexplorer.ee.transfer_function ¶
Rational transfer functions H = N/D and their canonical views.
The design center is that :class:TransferFunction is a plain complex callable:
tf(s) evaluates polyval(num, s) / polyval(den, s), so the object composes with every
complexplorer renderer directly — cp.plot(domain, tf), cp.plot_landscape_pv,
cp.riemann_pv, cp.quick_plot, and STL export all accept it as an ordinary function.
The views in this module add the EE-specific annotations on top:
- :func:
pole_zero_plot— poles×, zeros○, stability boundary - :func:
bode_plot— magnitude (dB) and phase (degrees) over log frequency - :func:
nyquist_plot— theH(jω)locus with the critical point−1marked - :func:
transfer_portrait— a phase portrait ofHwith poles/zeros and the stability boundary overlaid (composes the standard 2Dplot()path)
Continuous-time systems (system="s") use the imaginary axis as frequency contour and
stability boundary; discrete-time systems (system="z") use the unit circle.
TransferFunction ¶
A rational transfer function H = N/D from polynomial coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num
|
sequence of numbers
|
Numerator coefficients in |
required |
den
|
sequence of numbers
|
Denominator coefficients (same order). Must not be identically zero. |
required |
system
|
str
|
|
"s"
|
Examples:
>>> H = TransferFunction([1], [1, 2, 2]) # 1 / (s^2 + 2s + 2)
>>> H.is_stable
True
>>> import complexplorer as cp
>>> cp.plot(cp.Rectangle(6, 6), H)
is_stable
property
¶
Strict stability: all poles in the open left half-plane (s) / unit disk (z).
Marginal poles (on the boundary) count as unstable — the conservative convention.
frequency_response ¶
Evaluate H along the frequency contour.
s = jω for continuous systems, z = e^{jω} for discrete systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
array - like
|
Frequencies (rad/s or rad/sample). If omitted, a log-spaced grid is chosen
spanning a decade beyond the smallest and largest nonzero pole/zero magnitude
(fallback |
None
|
Returns:
| Type | Description |
|---|---|
(omega, response) : tuple of ndarray
|
The frequency grid and the complex response |
pole_zero_plot ¶
Pole-zero map: poles ×, zeros ○, stability boundary dashed.
Returns the matplotlib axes.
bode_plot ¶
Bode plot: magnitude 20·log10|H| (dB) and phase (degrees) over log frequency.
Returns the matplotlib figure (two stacked panels sharing the frequency axis).
nyquist_plot ¶
Nyquist plot: the locus of H along the frequency contour, −1 marked.
Positive frequencies are drawn solid; the mirrored negative-frequency branch dashed. Returns the matplotlib axes.
transfer_portrait ¶
transfer_portrait(tf: TransferFunction, domain: Rectangle | None = None, resolution: int = 400, ax: Axes | None = None, title: str | None = None, **plot_kwargs)
Phase portrait of H with poles/zeros and the stability boundary overlaid.
Composes the standard 2D plot() path (so options like cmap= and legend=True
are honored). When no domain is given, a square domain enclosing all poles and zeros
(with margin) is used.
Returns the matplotlib axes.