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
Magnitude of the Bode plot.
use lti bodemag(a) bodemag(a, style, id) (mag, w) = bodemag(a)
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.
Green plot for
G = tf(1, [1, 2, 3, 4]); bodemag(G, 'g');
The same plot, between
scale([0,10]); bodemag(G, Color='green');
Frequency response of the discrete-time system
H = zpk([], [0.9,0.7+0.6j,0.7-0.6j], 1, 1); bodemag(H);
lti::bodephase, lti::nichols, lti::nyquist, plotset, bodemag
Phase of the Bode plot.
use lti bodephase(a) bodephase(a, style, id) (phase, w) = bodephase(a)
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.
lti::bodemag, lti::nichols, lti::nyquist, plotset, bodephase
Impulse response.
use lti impulse(a) impulse(a, style, id) (y, t) = impulse(a)
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.
Impulse response of the first order transfer function
G = tf(1, [1/2, 1]); impulse(G);
lti::step, lti::lsim, ss::initial, plotset, impulse
Time response with initial conditions.
use lti initial(a, x0) initial(a, x0, style, id) (y, t) = initial(a, x0)
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.
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])
lti::impulse, lti::step, lti::lsim, plotset, initial
Time response.
use lti lsim(a, u, t) lsim(a, u, t, style, id) (y, t) = lsim(a, u, t)
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.
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');
lti::impulse, lti::step, ss::initial, plotset, lsim
Nichols plot.
use lti nichols(a, ...) (mag, phase, w) = nichols(a, ...)
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.
lti::nyquist, lti::bodemag, lti::bodephase, plotset, nichols
Nyquist plot.
use lti nyquist(a, ...) (re, im, w) = nyquist(a, ...)
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.
lti::nichols, lti::bodemag, lti::bodephase, plotset, nyquist
Pole/zero map.
use lti pzmap(a) pzmap(a, style)
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.
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);
lti::rlocus, plotset, plotroots
Root locus.
use lti rlocus(a) rlocus(a, style, id)
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.
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);
Step response.
use lti step(a) step(a, style, id) (y, t) = step(a)
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.