Qu

bode

Builtin index · Signal processing

bode(Z, [freqs], [color=], [label=], [marker="line"])

Input: Z, freqs, color, label, marker · Output: no output

What it is

Draws a complete two-panel Bode figure — magnitude in dB above, phase in degrees below, both against a log frequency axis — and returns Nothing. Also bode(filt, [n=512]) for a "filter" model: its response at n log-spaced frequencies from fs/2/n up to Nyquist, phase unwrapped (normalized axis, Nyquist = 1, when the filter carries no fs). Z: an frf/impedance model (from transfer_function or impedance(v, i)), which already carries its own freq axis so no second argument is needed; or a plain CVec, which carries no axis and so must be given the matching length-N freqs vector (Hz) positionally. color/label/marker (optional strings): plot styling. This is §11's self-plotting Z.bode(); bode_magnitude/bode_phase remain available for a script that wants one half in a panel of its own choosing. Added in v0.3.0.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
bode(Z, [freqs], [color=], [label=], [marker="line"])
Z —Z: an frf/impedance model (from transfer_function or impedance(v, i)), which already carries its own freq axis so no second argument is needed.
freqs CVec or vector, optionalor a plain CVec, which carries no axis and so must be given the matching length-N freqs vector (Hz) positionally.
color string, optionalcolor/label/marker (optional strings): plot styling.
label string, optionalcolor/label/marker (optional strings): plot styling.
marker string, optional (default "line")color/label/marker (optional strings): plot styling.
not documented yetDraws a complete two-panel Bode figure — magnitude in dB above, phase in degrees below, both against a log frequency axis — and returns Nothing. Also bode(filt, [n=512]) for a "filter" model: its response at n log-spaced frequencies from fs/2/n up to Nyquist, phase unwrapped (normalized axis, Nyquist = 1, when the filter carries no fs). Added in v0.3.0.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

bode(Z) / bode(Z, freqs) — toolkit-signal.md §11's Z.bode(): magnitude AND phase, two stacked panels, one call. This deliberately does what the comment on bode_magnitude/ bode_phase just above declined to do, and the difference is the frequency axis. Those two take a BARE complex vector, so a script must supply freqs anyway and is already managing the figure; splitting them leaves it in control of its own layout. A kind="frf"/kind="impedance" handle CARRIES its axis, and §11 asks that such a value "knows how to plot itself, correctly, once" -- at which point requiring two calls plus a hand-built panel(2,1,k) grid is asking the caller to reassemble something the value already knows. Both spellings stay: bode(Z) for the whole picture, bode_magnitude/bode_phase when a script wants one half in a panel of its own choosing. Flagged in board2.txt as a genuine tension with that documented decision.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.