Library "lti" defines methods related to objects which represent linear time-invariant dynamical systems. LTI systems may be used to model many different systems: electro-mechanical devices, robots, chemical processes, filters, etc. LTI systems map one or more inputs u to one or more outputs y. The mapping is defined as a state-space model or as a matrix of transfer functions, either in continuous time or in discrete time. Methods are provided to create, combine, and analyze LTI objects.
The following statement makes available functions defined in lti:
use lti
LTI state-space constructor.
a = ss a = ss(A, B, C, D) a = ss(A, B, C, D, Ts) a = ss(A, B, C, D, Ts, var) a = ss(A, B, C, D, b) a = ss(b)
ss(A,B,C,D) creates an LTI object which represents the continuous-time state-space model
x'(t) = A x(t) + B u(t) y(t) = C x(t) + D u(t)
ss(A,B,C,D,Ts) creates an LTI object which represents the discrete-time state-space model with sample time Ts
x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k)
In both cases, if D is 0, it is resized to match the size of B and C if necessary. An additional argument var may be used to specify the variable of the Laplace ('s' (default) or 'p') or z transform ('z' (default) or 'q').
ss(A,B,C,D,b), where b is an LTI object, creates a state-space model of the same kind (continuous/discrete time, sampling time and variable) as b.
ss(b) converts the LTI object b to a state-space model.
sc = ss(-1, [1,2], [2;5], 0) sc = continuous-time LTI state-space system A = -1 B = 1 2 C = 2 5 D = 0 0 0 0 sd = ss(tf(1,[1,2,3,4],0.1)) sd = discrete-time LTI state-space system, Ts=0.1 A = -2 -3 -4 1 0 0 0 1 0 B = 1 0 0 C = 0 0 1 D = 0
LTI transfer function constructor.
a = tf a = tf(num, den) a = tf(numlist, denlist) a = tf(..., Ts) a = tf(..., Ts, var) a = tf(..., b) a = tf(b)
tf(num,den) creates an LTI object which represents the continuous-time transfer function specified by descending-power coefficient vectors num and den. tf(num,den,Ts) creates an LTI object which represents a discrete-time transfer function with sample time Ts.
In both cases, num and den may be replaced with lists of lists of coefficients; sublists represent the rows of the matrix of transfer functions. The number of sublists is the number of system outputs, and the number of vectors of coefficients in each sublist is the number of system inputs.
An additional argument var may be used to specify the variable of the Laplace ('s' (default) or 'p') or z transform ('z' (default) or 'q').
tf(...,b), where b is an LTI object, creates a transfer function of the same kind (continuous/discrete time, sampling time and variable) as b.
tf(b) converts the LTI object b to a transfer function.
sc = tf(1,[1,2,3,4],'p') sc = continuous-time transfer function 1/(p^3+2p^2+3p+4)
Append the inputs and outputs of systems.
b = append(a1, a2, ...)
append(a1,a2) builds a system with inputs [u1;u2] and outputs [y1;y2], where u1 and u2 are ths inputs of a1 and y1 and y2 their outputs, respectively. append accepts any number of input arguments.
Extend the output of a system with its states.
b = augstate(a)
augstate(a) extends the ss object a by adding its states to its outputs. The new output yext is [y;x], where y is the output of a and x is its states.
Conversion from continuous time to discrete time.
b = c2d(a, Ts) b = c2d(a, Ts, method)
c2d(a,Ts) converts the continuous-time system a to a discrete-time system with sample time Ts.
c2d(a,Ts,method) uses the specified conversion method. method is one of the methods supported by c2dm.
Arbitrary feedback connections.
b = connect(a, links, in, out)
connect(a,links,in,out) modifies lti object a by connecting some of the outputs to some of the inputs and by keeping some of the inputs and some of the outputs. Connections are specified by the rows of matrix link. In each row, the first element is the index of the system input where the connection ends; other elements are indices to system outputs which are summed. The sign of the indices to outputs gives the sign of the unit weight in the sum. Zeros are ignored. Arguments in and out specify which input and output to keep.
Conversion from discrete time to continuous time.
b = d2c(a) b = d2c(a, method)
d2c(a) converts the discrete-time system a to a continuous-time system.
d2c(a,method) uses the specified conversion method. method is one of the methods supported by d2cm.
Frequency value.
y = evalfr(a, x)
evalfr(a,x) evaluates system a at complex value or values x.
Controlability matrix.
C = crtb(a)
ctrb(a) gives the controlability matrix of system a, which is full-rank if and only if a is controlable.
Feedback connection.
c = feedback(a, b) c = feedback(a, b, sign) c = feedback(a, b, ina, outa) c = feedback(a, b, ina, outa, sign)
feedback(a,b) connects all the outputs of lti object a to all its inputs via the negative feedback lti object b.
feedback(a,b,sign) applies positive feedback with weight sign; the default value of sign is -1.
feedback(a,b,ina,outa) specifies which inputs and outputs of a to use for feedback. The inputs and outputs of the result always correspond to the ones of a.
Test for an LTI without input/output.
b = isempty(a)
isempty(a) is true if system a has no input and/or no output, and false otherwise.
Test for a single-input single-output LTI.
b = issiso(a)
issiso(a) is true if lti object a has one input and one output (single-input single-output system, or SISO), or false otherwise.
Test for a proper (causal) LTI.
b = isproper(a)
isproper(a) is true if lti object a is causal, or false otherwise. An ss object is always causal. A tf object is causal if all the transfer functions are proper, i.e. if the degrees of the denominators are at least as large as the degrees of the numerators.
Minimum realization.
b = minreal(a) b = minreal(a, tol)
minreal(a) modifies lti object a in order to remove states which are not controllable and/or not observable. For tf objects, identical zeros and poles are canceled out.
minreal(a,tol) uses tolerance tol to decide whether to discard a state or a pair of pole/zero.
Observability matrix.
O = obsv(a)
obsv(a) gives the observability matrix of system a, which is full-rank if and only if a is observable.
Parallel connection.
c = parallel(a, b) c = parallel(a, b, ina, inb, outa, outb)
parallel(a,b) connects lti objects a and b in such a way that the inputs of the result is applied to both a and b, and the outputs of the result is their sum.
parallel(a,b,ina,inb,outa,outb) specifies which inputs are shared between a and b, and which outputs are summed. The inputs of the result are partitioned as [ua,uab,ub] and the outputs as [ya,yab,yb]. Inputs uab are fed to inputs ina of a and inb of b; inputs ua are fed to the remaining inputs of a, and ub to the remaining inputs of b. Similarly, outputs yab are the sum of outputs outa of a and outputs outb of b, and ya and yb are the remaining outputs of a and b, respectively.
Series connection.
c = series(a, b) c = series(a, b, outa, inb)
series(a,b) connects the outputs of lti object a to the inputs of lti object b.
series(a,b,outa,inb) connects outputs outa of a to inputs inb of b. Unconnected outputs of a and inputs of b are discarded.
Replicate a system.
b = repmat(a, n) b = repmat(a, [m,n]) b = repmat(a, m, n)
repmat(a,n), when a is a transfer function or a matrix of transfer functions, creates a new system described by a matrix of transfer functions where a is repeated n times horizontally and vertically. If a is a state-space system, conversions to and from a matrix of transfer functions are performed.
repmat(a,[m,n]) or repmat(a,m,n) repeats matrix a m times vertically and n times horizontally.
Number of outputs and inputs.
s = size(a) (nout, nin) = size(a) n = size(a, dim)
With one output argument, size(a) gives the row vector [nout,nin], where nout is the number of outputs of system a and nin its number of inputs. With two output arguments, size(a) returns these results separately as scalars.
size(a,1) gives only the number of outputs, and size(a,2) only the number of inputs.
LTI transfer function constructor using zeros and poles.
a = zpk(z, p, k) a = zpk(zeroslist, poleslist, gainlist) a = zpk(..., Ts) a = zpk(..., Ts, var) a = zpk(..., b) a = zpk(b)
zpk creates transfer-function LTI systems like tf. Instead of using transfer function coefficients as input, it accepts a vector of zeros, a vector of poles, and a gain for a simple-input simple-output (SISO) system; or lists of sublists of zeros, poles and gains for multiple-input multiple-output (MIMO) systems.
sd = zpk(0.3, [0.8+0.5j; 0.8-0.5j], 10, 0.1) sd = discrete-time transfer function, Ts=0.1 (10z-3)/(z^2-1.6z+0.89)