Next: cacsd, Previous: systime, Up: Control Theory

— Function File: [`mag`, `phase`, `w`] = **bode** (`sys, w, out_idx, in_idx`)

If no output arguments are given: produce Bode plots of a system; otherwise, compute the frequency response of a system data structure

Inputs

sys- a system data structure (must be either purely continuous or discrete; see is_digital)
w- frequency values for evaluation.
if

sysis continuous, then bode evaluates G(jw) where G(s) is the system transfer function.if

sysis discrete, then bode evaluates G(`exp`

(jwT)), where

- T is the system sampling time
- G(z) is the system transfer function.

Defaultthe default frequency range is selected as follows: (These steps arenotperformed ifwis specified)

- via routine __bodquist__, isolate all poles and zeros away from
w=0 (jw=0 or`exp`

(jwT)=1) and select the frequency range based on the breakpoint locations of the frequencies.- if
sysis discrete time, the frequency range is limited to jwT in [0,2 pi /T]- A "smoothing" routine is used to ensure that the plot phase does not change excessively from point to point and that singular points (e.g., crossovers from +/- 180) are accurately shown.
out_idxin_idx- The names or indices of outputs and inputs to be used in the frequency response. See
`sysprune`

.

Examplebode(sys,[],"y_3", {"u_1","u_4"});Outputs

magphase- the magnitude and phase of the frequency response G(jw) or G(
`exp`

(jwT)) at the selected frequency values.w- the vector of frequency values used

- If no output arguments are given, e.g.,
bode(sys);bode plots the results to the screen. Descriptive labels are automatically placed.

Failure to include a concluding semicolon will yield some garbage being printed to the screen (

`ans = []`

).- If the requested plot is for an MIMO system, mag is set to ||G(jw)|| or ||G(
`exp`

(jwT))|| and phase information is not computed.

— Function File: [`wmin`, `wmax`] = **bode_bounds** (`zer, pol, dflg, tsam`)

Get default range of frequencies based on cutoff frequencies of system poles and zeros. Frequency range is the interval [10^

wmin, 10^wmax]Used internally in

__freqresp__(bode,nyquist)

— Function File: **freqchkw** (`w`)

Used by

__freqresp__to check that input frequency vectorwis valid. Returns boolean value.

— Function File: `out` = **ltifr** (`a, b, w`)

— Function File:`out` = **ltifr** (`sys, w`)

— Function File:

Linear time invariant frequency response of single-input systems.

Inputs

ab- coefficient matrices of dx/dt = A x + B u
sys- system data structure
w- vector of frequencies
Output

out- frequency response, that is:
-1 G(s) = (jw I-A) Bfor complex frequencies s = jw.

— Function File: [`realp`, `imagp`, `w`] = **nyquist** (`sys, w, out_idx, in_idx, atol`)

— Function File:**nyquist** (`sys, w, out_idx, in_idx, atol`)

— Function File:

Produce Nyquist plots of a system; if no output arguments are given, Nyquist plot is printed to the screen.

Compute the frequency response of a system.

Inputs(pass as empty to get default values)

sys- system data structure (must be either purely continuous or discrete; see
`is_digital`

)w- frequency values for evaluation. If sys is continuous, then bode evaluates G(
jw); if sys is discrete, then bode evaluates G(exp(jwT)), whereTis the system sampling time.default- the default frequency range is selected as follows: (These steps are
notperformed ifwis specified)

- via routine
__bodquist__, isolate all poles and zeros away fromw=0 (jw=0 or exp(jwT)=1) and select the frequency range based on the breakpoint locations of the frequencies.- if
sysis discrete time, the frequency range is limited tojwTin [0,2p*pi]- A “smoothing” routine is used to ensure that the plot phase does not change excessively from point to point and that singular points (e.g., crossovers from +/- 180) are accurately shown.
atol- for interactive nyquist plots: atol is a change-in-slope tolerance for the of asymptotes (default = 0; 1e-2 is a good choice). This allows the user to “zoom in” on portions of the Nyquist plot too small to be seen with large asymptotes.
Outputs

realpimagp- the real and imaginary parts of the frequency response G(jw) or G(exp(jwT)) at the selected frequency values.
w- the vector of frequency values used
If no output arguments are given, nyquist plots the results to the screen. If

atol!= 0 and asymptotes are detected then the user is asked interactively if they wish to zoom in (remove asymptotes) Descriptive labels are automatically placed.Note: if the requested plot is for an MIMO system, a warning message is presented; the returned information is of the magnitude ||G(jw)|| or ||G(exp(jwT))|| only; phase information is not computed.

— Function File: [`zer`, `gain`] = **tzero** (`a, b, c, d, opt`)

— Function File: [`zer`, `gain`] = **tzero** (`sys, opt`)

— Function File: [

Compute transmission zeros of a continuous system:

. x = Ax + Bu y = Cx + Duor of a discrete one:

x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k)

Outputs

zer- transmission zeros of the system
gain- leading coefficient (pole-zero form) of SISO transfer function returns gain=0 if system is multivariable
References

- Emami-Naeini and Van Dooren, Automatica, 1982.
- Hodel, Computation of Zeros with Balancing, 1992 Lin. Alg. Appl.