LyME - Miscellaneous Functions

This section describes the non-graphic functions of LyME borrowed from SysQuake.

c2dm

Continuous-to-discrete-time conversion.

Syntax

(numd,dend) = c2dm(numc,denc,Ts)
dend = c2dm(numc,denc,Ts)
(numd,dend) = c2dm(numc,denc,Ts,method)
dend = c2dm(numc,denc,Ts,method)
(Ad,Bd,Cd,Dd) = c2dm(Ac,Bc,Cc,Dc,Ts,method)

Description

(numd,dend) = c2dm(numc,denc,Ts) converts the continuous-time transfer function numc/denc to a discrete-time transfer function numd/dend with sample time Ts. The continuous-time transfer function is given by two polynomials in s, and the discrete-time transfer function is given by two polynomials in z, all as vectors of coefficients with highest powers first.

Method is one of

'zoh' or 'z' zero-order hold (default)
'tustin' or 't' Tustin (bilinear transformation)

The input and output arguments numc, denc, numd, and dend can also be matrices; in that case, the conversion is applied separately on each row with the same sample time Ts.

c2dm(Ac,Bc,Cc,Dc,Ts,method) performs the conversion from continuous-time state-space model (Ac,Bc,Cc,Dc) to discrete-time state-space model (Ad,Bd,Cd,Dd), defined by

dx/dt = Ac x + Bc u
y     = Cc x + Dc u
and
x(k+1) = Ad x(k) + Bd u(k)
y(k)   = Cd x(k) + Dd u(k)

Examples

(numd, dend) = c2dm(1, [1, 1], 5)
  numd =
    0.9933
  dend =
    1 -6.7379e-3
(numd, dend) = c2dm(1, [1, 1], 5, 'tustin')
  numd =
    0.7143 0.7143
  dend =
    1 0.4286

See also

d2cm, step

d2cm

Discrete-to-continuous-time conversion.

Syntax

(numc,denc) = d2cm(numd,dend,Ts)
denc = d2cm(numd,dend,Ts)
(numc,denc) = d2cm(numd,dend,Ts,method)
denc = d2cm(numd,dend,Ts,method)

Description

(numc,denc) = d2cm(numd,dend,Ts,method) converts the discrete-time transfer function numd/dend with sample time Ts to a continuous-time transfer function numc/denc. The continuous-time transfer function is given by two polynomials in s, and the discrete-time transfer function is given by two polynomials in z, all as vectors of coefficients with highest powers first.

Method is

tustin or 't' Tustin (bilinear transformation) (default)

The input and output arguments numc, denc, numd, and dend can also be matrices; in that case, the conversion is applied separately on each row with the same sample time Ts.

d2cm(Ad,Bd,Cd,Dd,Ts,method) performs the conversion from discrete-time state-space model (Ad,Bd,Cd,Dd) to continuous-time state-space model (Ac,Bc,Cc,Dc), defined by

x(k+1) = Ad x(k) + Bd u(k)
y(k)   = Cd x(k) + Dd u(k)
and
dx/dt = Ac x + Bc u
y     = Cc x + Dc u

Example

(numd, dend) = c2dm(1, [1, 1], 5, 't')
  numd =
    0.7143 0.7143
  dend =
    1 0.4286
(numc, denc) = d2cm(numd, dend)
  numc =
    -3.8858e-17 1
  denc =
    1 1

See also

c2dm

ss2tf

Conversion from state space to transfer function.

Syntax

(num,den) = ss2tf(A,B,C,D)
den = ss2tf(A,B,C,D)
(num,den) = ss2tf(A,B,C,D,iu)
den = ss2tf(A,B,C,D,iu)

Description

A continuous-time linear time-invariant system can be represented by the state-space model

dx/dt = A x + B u
y     = C x + D u

where x is the state, u the input, y the output, and ABCD four constant matrices which characterize the model. If it is a single-input single-output system, it can also be represented by its transfer function num/den. (num,den) = ss2tf(A,B,C,D) converts the model from state space to transfer function. If the state-space model has multiple outputs, num is a matrix whose lines correspond to each output (the denominator is the same for all outputs). If the state-space model has multiple inputs, a fifth input argument is required and specifies which one to consider.

For a sampled-time model, exactly the same function can be used. The derivative is replaced by a forward shift, and the variable s of the Laplace transform is replaced by the variable z of the z transform. But as long as coefficients are concerned, the conversion is the same.

The degree of the denominator is equal to the number of states, i.e. the size of A. The degree of the numerator is equal to the number of states if D is not null, and one less if D is null.

Example

(num, den) = ss2tf(-1, 1, 1, 0)
  num =
    1
  den =
    1 1

See also

tf2ss

tf2ss

Conversion from transfer function to state space.

Syntax

(A,B,C,D) = tf2ss(num,den)

Description

tf2ss(num,den) returns the state-space representation of the transfer function num/den, which is given as two polynomials. The transfer function must be causal, i.e. num must not have more columns than den. Systems with several outputs are specified by a num having one row per output; the denominator den must be the same for all the outputs.

tf2ss applies to continuous-time systems (Laplace transform) as well as to discrete-time systems (z transform or delta transform).

Example

(A,B,C,D) = tf2ss([2,5],[2,3,8])
  A =
    -1.5 -4
    1 0
  B =
    1
    0
  C =
    1 2.5
  D =
    0

See also

ss2tf


Copyright 1998-2001, Calerga.

All rights reserved.