Next: , Previous: sysprop, Up: Control Theory


29.7 System Analysis-Time Domain

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

Converts the system data structure describing:

          .
          x = Ac x + Bc u
     

into 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 sys is 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 sys is purely continuous.

Note: if the second argument is not a string, c2d() assumes that the second argument is t and performs appropriate argument checks.

Output

dsys
Discrete time equivalent via zero-order hold, sample each t sec.

This function adds the suffix _d to the names of the new discrete states.

— Function File: d2c (sys, tol)
— Function File: d2c (sys, opt)

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), with tol positive scalar, the "log" option is used. The default value for tol is 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 sys is not purely discrete

Output
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, sprefix are sampled at ts2, all others are assumed sampled at ts1 = sysgettsam (sys).

Inputs

sys
discrete time system; dmr2d exits with an error if sys is not discrete
idx
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, sprefix must be an integer multiple of sysgettsam(sys)
cuflg
"constant u flag" if cuflg is nonzero then the system inputs are assumed to be constant over the revised sampling interval ts2. Otherwise, since the inputs can change during the interval t in [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. default cuflg = 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 k ts2, 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. (ts1 is the original sampling time of the discrete time system and ts2 = (n+1)*ts1)

fidx
indices of "formerly fast" states specified by idx and sprefix; these states are updated to the new (slower) sampling interval ts2.

WARNING Not thoroughly tested yet; especially when cuflg == 0.

— Function File: damp (p, tsam)

Displays eigenvalues, natural frequencies and damping ratios of the eigenvalues of a matrix p or the A matrix of a system p, respectively. If p is a system, tsam must not be specified. If p is a matrix and tsam is specified, eigenvalues of p are assumed to be in z-domain.

— Function File: dcgain (sys, tol)

Returns dc-gain matrix. If dc-gain is infinite an empty matrix is returned. The argument tol is an optional tolerance for the condition number of the A Matrix in sys (default tol = 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 system sys.

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 tstop and n can 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 system sys.

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 tstop and n can 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 y the plot is not displayed.