Sysquake Pro – Table of Contents

Sysquake for LaTeX – Table of Contents

# Library - `lti` (graphics)

In addition to the class definitions and the computational methods, library
`lti`
includes methods which provide for `lti` objects the same functionality as
the native graphical functions of Sysquake for dynamical systems, such as `bodemag`
for the magnitude of the Bode diagram or `step` for the step response.
The system is provided as a single `lti` object instead of separate vectors for
the numerator and denominator or four matrices for state-space models. For
discrete-time systems, the sampling time is also obtained from the object, and
the method name is the same as its continuous-time equivalent, without an initial
`d` (e.g. `step(G)` is the discrete-time step response of
`G` if `G` is a discrete-time `tf`, `zpk`
or `ss` object).

The method definitions are stored in a separate file which is referenced in
`lti` with
`includeifexists`;
this means that only `lti` must be loaded, with

use lti

## Functions

### lti::bodemag

Magnitude of the Bode plot.

#### Syntax

use lti bodemag(a) bodemag(a, style, id) (mag, w) = bodemag(a)

#### Description

`bodemag(a)` plots the magnitude of the Bode diagram of system `a`,
which can be any lti object with a single input (`size(a,2)` must
be 1), continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `bodemag` gives the magnitude and the frequency
as column vectors. No display is produced.

#### Examples

Green plot for
`abs(1 / (s^3 + 2s^2 + 3s + 4))``s = jw`

G = tf(1, [1, 2, 3, 4]); bodemag(G, 'g');

The same plot, between `w=0``w=10`

scale([0,10]); bodemag(G, Color='green');

Frequency response of the discrete-time system
`1/(z-0.9)(z-0.7-0.6j)(z-0.7+0.6j)`

H = zpk([], [0.9,0.7+0.6j,0.7-0.6j], 1, 1); bodemag(H);

#### See also

`lti::bodephase`,
`lti::nichols`,
`lti::nyquist`,
`plotset`,
`bodemag`

### lti::bodephase

Phase of the Bode plot.

#### Syntax

use lti bodephase(a) bodephase(a, style, id) (phase, w) = bodephase(a)

#### Description

`bodephase(a)` plots the phase of the Bode diagram of system `a`,
which can be any lti object with a single input (`size(a,2)` must
be 1), continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `bodephase` gives the phase and the frequency
as column vectors. No display is produced.

#### See also

`lti::bodemag`,
`lti::nichols`,
`lti::nyquist`,
`plotset`,
`bodephase`

### lti::impulse

Impulse response.

#### Syntax

use lti impulse(a) impulse(a, style, id) (y, t) = impulse(a)

#### Description

`impulse(a)` plots the impulse response of system `a`,
which can be any lti object with a single input (`size(a,2)` must
be 1), continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `impulse` gives the output and the time
as column vectors. No display is produced.

#### Example

Impulse response of the first order transfer function
`1/(s/2+1)`

G = tf(1, [1/2, 1]); impulse(G);

#### See also

`lti::step`,
`lti::lsim`,
`ss::initial`,
`plotset`,
`impulse`

### ss::initial

Time response with initial conditions.

#### Syntax

use lti initial(a, x0) initial(a, x0, style, id) (y, t) = initial(a, x0)

#### Description

`initial(a,x0)` plots the time response of state-space system
`a` with initial state `x0` and null input.
System `a` can be continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `initial` gives the output and the time
as column vectors. No display is produced.

#### Example

Response of a continuous-time system whose initial state is
`[5;3]`:

a = ss([-0.3,0.1;-0.8,-0.4], [2;3], [1,3;2,1], [2;1]); initial(a, [5;3])

#### See also

`lti::impulse`,
`lti::step`,
`lti::lsim`,
`plotset`,
`initial`

### lti::lsim

Time response.

#### Syntax

use lti lsim(a, u, t) lsim(a, u, t, style, id) (y, t) = lsim(a, u, t)

#### Description

`lsim(a,u,t)` plots the time response of system `a`.
For continuous-time systems, the input is piece-wise linear; it is defined by
points in real vectors `t` and `u`, which must have the same
length. Input before `t(1)` and after `t(end)` is 0.
For discrete-time systems, `u` is sampled at the rate given by the
system, and `t` is ignored or can be omitted.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `lsim` gives the output and the time
as column vectors. No display is produced.

#### Example

Response of continuous-time system given by its transfer function with an input defined by linear segments, displayed as a solid blue line:

G = tf(1, [1, 2, 3, 4]); t = [0, 10, 20, 30, 50]; u = [1, 1, 0, 1, 1]; lsim(G, u, t, Color = 'blue');

#### See also

`lti::impulse`,
`lti::step`,
`ss::initial`,
`plotset`,
`lsim`

### lti::nichols

Nichols plot.

#### Syntax

use lti nichols(a, ...) (mag, phase, w) = nichols(a, ...)

#### Description

`nichols(a)` plots the Nichols diagram of system `a`,
which can be any lti object with a single input (`size(a,2)` must
be 1), continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `nichols` gives the magnitude, the phase
and the corresponding frequency as column vectors. No display is produced.

#### See also

`lti::nyquist`,
`lti::bodemag`,
`lti::bodephase`,
`plotset`,
`nichols`

### lti::nyquist

Nyquist plot.

#### Syntax

use lti nyquist(a, ...) (re, im, w) = nyquist(a, ...)

#### Description

`nyquist(a)` plots the Nyquist diagram of system `a`,
which can be any lti object with a single input (`size(a,2)` must
be 1), continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `nyquist` gives the real part, the imaginary
part and the corresponding frequency as column vectors. No display is produced.

#### See also

`lti::nichols`,
`lti::bodemag`,
`lti::bodephase`,
`plotset`,
`nyquist`

### lti::pzmap

Pole/zero map.

#### Syntax

use lti pzmap(a) pzmap(a, style)

#### Description

`pzmap(a)` plots the poles and the zeros of system `a`
in the complex plane. Poles are represented with crosses and zeros with circles.
The system must be SISO (single-input, single-output).

With a second input argument, `pzmap(a,style)` uses the specified
style for the poles and zeros. Typically, `style` is a structure array
of two elements: the first element contains style options for the poles, and the second
element, for the zeros. An empty structure (0 element) stands for the default
style, and a simple structure uses the same style for the poles and the zeros.

#### Examples

Pole/zero map of a transfer function:

use lti G = tf([2, 3, 4], [1, 2, 3, 4]); pzmap(G);

Pole/zero map with the same scale along x and y axes, a grid showing relative damping and natural frequencies, and explicit style:

use lti G = tf([2, 3, 4], [1, 2, 3, 4]); scale equal; sgrid; plotoption fullgrid; style = { Marker='x', MarkerEdgeColor='red'; Marker='o', MarkerEdgeColor='navy', MarkerFaceColor='yellow' } pzmap(G, style);

#### See also

`lti::rlocus`,
`plotset`,
`plotroots`

### lti::rlocus

Root locus.

#### Syntax

use lti rlocus(a) rlocus(a, style, id)

#### Description

`rlocus(a)` plots the root locus of system `a`, i.e. the
locus of the poles of the system obtained by adding a feedback loop with a positive
real gain. Only the root locus itself is displayed, as a solid line by default.
Open-loop poles and zeros (the extremities of the root locus), which are typically
displayed with special markers, can be added with `pzmap`.

The optional arguments `style` and `id` have their
usual meaning.

#### Example

Root locus of a transfer function with open-loop poles and zeros displayed
with `pzmap`. The scale is the same along x and y axes thanks to a
call to `scale`, and a grid shows relative damping and natural frequencies.

use lti G = tf([2, 3, 1], [1, 2, 3, 4]); scale equal; sgrid; plotoption fullgrid; rlocus(G); pzmap(G);

#### See also

### lti::step

Step response.

#### Syntax

use lti step(a) step(a, style, id) (y, t) = step(a)

#### Description

`step(a)` plots the step response of system `a`,
which can be any lti object with a single input (`size(a,2)` must
be 1), continuous-time or discrete-time.

The optional arguments `style` and `id` have their
usual meaning.

With output arguments, `step` gives the output and the time as
column vectors. No display is produced.