sysfreq - Untitled
Description: Untitled

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

### 30.8 System Analysis-Frequency Domain

Demonstration/tutorial script

— Function File: frdemo ()

> Octave Control Toolbox demo: Frequency Response demo.

— 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 sys is continuous, then bode evaluates G(jw) where G(s) is the system transfer function.

>   if sys is discrete, then bode evaluates G(`exp`(jwT)), where

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

>   Default the default frequency range is selected as follows: (These steps are not performed if w is specified)

>   1. 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.
>   2. if sys is discrete time, the frequency range is limited to jwT in [0,2 pi /T]
>   3. 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_idx
> in_idx
>   The names or indices of outputs and inputs to be used in the frequency response. See `sysprune`.

>   Example

>                      bode(sys,[],"y_3", {"u_1","u_4"});

> Outputs
> mag
> phase
>   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
> 1. 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 = []`).

> 2. 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 vector w is valid. Returns boolean value.

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

> Linear time invariant frequency response of single-input systems.

> Inputs

> a
> b
>   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) B

> for 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)

> 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)), where T is the system sampling time.
> default
>   the default frequency range is selected as follows: (These steps are not performed if w is specified)
>   1. 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.
>   2. if sys is discrete time, the frequency range is limited to jwT in [0,2p*pi]
>   3. 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
> realp
> imagp
>   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: [mag, phase, w] = nichols (sys, w, outputs, inputs)

> Produce Nichols plot of a system.

> Inputs

> sys
>   System data structure (must be either purely continuous or discrete; see `is_digital`).
> w
>   Frequency values for evaluation.
>   - if sys is continuous, then nichols evaluates G(jw).
>   - if sys is discrete, then nichols evaluates G(exp(jwT)), where T=sys. tsam is the system sampling time.
>   - the default frequency range is selected as follows (These steps are not performed if w is specified):
>     1. 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.
>     2. if sys is discrete time, the frequency range is limited to jwT in [0,2p*pi].
>     3. 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.
> outputs
> inputs
>   the names or indices of the output(s) and input(s) to be used in the frequency response; see `sysprune`.
> Outputs
> mag
> phase
>   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, `nichols` plots the results to the screen. Descriptive labels are automatically placed. See `xlabel`, `ylabel`, and `title`.

> Note: 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: [zer, gain] = tzero (a, b, c, d, opt)
— Function File: [zer, gain] = tzero (sys, opt)

> Compute transmission zeros of a continuous system:

>               .
>               x = Ax + Bu
>               y = Cx + Du

> or 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
> 1. Emami-Naeini and Van Dooren, Automatica, 1982.
> 2. Hodel, Computation of Zeros with Balancing, 1992 Lin. Alg. Appl.

— Function File: zr = tzero2 (a, b, c, d, bal)

> Compute the transmission zeros of a, b, c, d.

> bal = balancing option (see balance); default is `"B"`.

> Needs to incorporate `mvzero` algorithm to isolate finite zeros; use `tzero` instead.