Next: sysfreq, Previous: sysprop, Up: Control Theory

— Function File: **c2d** (`sys, opt, t`)

— Function File:**c2d** (`sys, t`)

— Function File:

Converts the system data structure describing:

. x = Ac x + Bc uinto a discrete time equivalent model:

x[n+1] = Ad x[n] + Bd u[n]via the matrix exponential or bilinear transform.

Inputs

sys- system data structure (may have both continuous time and discrete time subsystems)
opt- string argument; conversion option (optional argument; may be omitted as shown above)

`"ex"`

- use the matrix exponential (default)
`"bi"`

- use the bilinear transformation
2(z-1) s = ----- T(z+1)FIXME: This option exits with an error if

sysis not purely continuous. (The`ex`

option can handle mixed systems.)`"matched"`

- Use the matched pole/zero equivalent transformation (currently only works for purely continuous SISO systems).
t- sampling time; required if
sysis purely continuous.

Note:if the second argument is not a string,`c2d()`

assumes that the second argument istand performs appropriate argument checks.

Output

dsys- Discrete time equivalent via zero-order hold, sample each
tsec.This function adds the suffix

`_d`

to the names of the new discrete states.

— Function File: **d2c** (`sys, tol`)

— Function File:**d2c** (`sys, opt`)

— Function File:

Convert a discrete (sub)system into a purely continuous one. The sampling time used is

`sysgettsam(`

sys`)`

.

Inputs

sys- system data structure with discrete components
tol- Scalar value. Tolerance for convergence of default
`"log"`

option (see below)opt- conversion option. Choose from:

`"log"`

- (default) Conversion is performed via a matrix logarithm. Due to some problems with this computation, it is followed by a steepest descent algorithm to identify continuous time
a,b, to get a better fit to the original data.If called as

`d2c (`

sys`,`

tol`)`

, withtolpositive scalar, the`"log"`

option is used. The default value fortolis`1e-8`

.`"bi"`

- Conversion is performed via bilinear transform z = (1 + s T / 2)/(1 - s T / 2) where T is the system sampling time (see
`sysgettsam`

).FIXME: bilinear option exits with an error if

sysis not purely discreteOutput

csys- continuous time system (same dimensions and signal names as in
sys).

— Function File: [`dsys`, `fidx`] = **dmr2d** (`sys, idx, sprefix, ts2, cuflg`)

convert a multirate digital system to a single rate digital system states specified by

idx,sprefixare sampled atts2, all others are assumed sampled atts1=`sysgettsam (`

sys`)`

.

Inputs

sys- discrete time system;
`dmr2d`

exits with an error ifsysis not discreteidx- indices or names of states with sampling time
`sysgettsam(`

sys`)`

(may be empty); see`cellidx`

sprefix- list of string prefixes of states with sampling time
`sysgettsam(`

sys`)`

(may be empty)ts2- sampling time of states not specified by
idx,sprefixmust be an integer multiple of`sysgettsam(`

sys`)`

cuflg- "constant u flag" if
cuflgis nonzero then the system inputs are assumed to be constant over the revised sampling intervalts2. Otherwise, since the inputs can change during the intervaltin [k ts2, (k+1) ts2], an additional set of inputs is included in the revised B matrix so that these intersample inputs may be included in the single-rate system. defaultcuflg= 1.

Outputs

dsys- equivalent discrete time system with sampling time
ts2.The sampling time of sys is updated to

ts2.if

cuflg=0 then a set of additional inputs is added to the system with suffixes _d1, ..., _dn to indicate their delay from the starting time kts2, i.e. u = [u_1; u_1_d1; ..., u_1_dn] where u_1_dk is the input k*ts1 units of time after u_1 is sampled. (ts1is the original sampling time of the discrete time system andts2= (n+1)*ts1)fidx- indices of "formerly fast" states specified by
idxandsprefix; these states are updated to the new (slower) sampling intervalts2.

WARNINGNot thoroughly tested yet; especially whencuflg== 0.

— Function File: **damp** (`p, tsam`)

Displays eigenvalues, natural frequencies and damping ratios of the eigenvalues of a matrix

por the A matrix of a systemp, respectively. Ifpis a system,tsammust not be specified. Ifpis a matrix andtsamis specified, eigenvalues ofpare assumed to be inz-domain.

— Function File: **dcgain** (`sys, tol`)

Returns dc-gain matrix. If dc-gain is infinite an empty matrix is returned. The argument

tolis an optional tolerance for the condition number of the A Matrix insys(defaulttol= 1.0e-10)

— Function File: [`y`, `t`] = **impulse** (`sys, inp, tstop, n`)

Impulse response for a linear system. The system can be discrete or multivariable (or both). If no output arguments are specified,

`impulse`

produces a plot or the impulse response data for systemsys.

Inputs

sys- System data structure.
inp- Index of input being excited
tstop- The argument
tstop(scalar value) denotes the time when the simulation should end.n- the number of data values.
Both parameters

tstopandncan be omitted and will be computed from the eigenvalues of the A Matrix.Outputs

y- Values of the impulse response.
t- Times of the impulse response.

— Function File: [`y`, `t`] = **step** (`sys, inp, tstop, n`)

Step response for a linear system. The system can be discrete or multivariable (or both). If no output arguments are specified,

`step`

produces a plot or the step response data for systemsys.

Inputs

sys- System data structure.
inp- Index of input being excited
tstop- The argument
tstop(scalar value) denotes the time when the simulation should end.n- the number of data values.
Both parameters

tstopandncan be omitted and will be computed from the eigenvalues of the A Matrix.Outputs

y- Values of the step response.
t- Times of the step response.
When invoked with the output parameter

ythe plot is not displayed.