ml_dt_ss_simulate

Discrete-time simulation of standard systems.

Contents

Syntax

[t, y, info] = ml_dt_ss_simulate(sys1, ..., sysN)
[t, y, info] = ml_dt_ss_simulate(sys1, ..., sysN, opts)
[t, y, info] = ml_dt_ss_simulate(sys, rom1, ..., romM)
[t, y, info] = ml_dt_ss_simulate(sys, rom1, ..., romM, opts)

Description

This function can be used to simulate first-order discrete-time dynamical systems of the form

   x(t+1) = A*x(t) + B*u(t),
     y(t) = C*x(t) + D*u(t).

If no input function u is given, the unit step response is computed.

Input

sys1, ..., sysN - struct, containing first-order descriptor systems {!} rom1, ..., romM - struct, containing first-order descriptor systems {!} * opts - structure, containing the following optional entries:

Parameter
Meaning
DiffMode
character array, determining type of plot
  • 'off' - time response plots of sys1, sys2, ...
  • 'abs' - absolute errors sys-rom1, sys-rom2, ...
  • 'rel' - relative errors sys-rom1, sys-rom2, ...
  • 'all' - all plot types are shown
default: 'off'
Info
{0, 1}, used to disable/enable display of sampling steps
default: 0
InputFcn
function handle, input function u(t) which takes a time argument and returns an input vector of appropriate size
default: ones(m, 1)
InputRange
vector of length <= 2, time range in which the input function u(t) is applied to the system, otherwise u = 0, if only a scalar tu0 is given, the input time interval is taken to be [tu0, tf]
default: opts.TimeRange
LineSpecs
{!}
character array, determining the line specifications for the plots
default: '-'
ShowPlot
{0, 1}, used to disable/enable showing of plots
default: 1
StoreStates
{0, 1}, used to disable/enable storing the computed system states additionally
default: 0
TimeRange
nonnegative vector of length <= 2, time range in which the system is simulated, if only a scalar tf is given, time range is set to be [0, tf]
default: [0 10]
X0
{!}
vector, initial states of x(t)
default: zeros(n, 1)

Note: Arguments/Parameters marked with {!} may also be a cell array containing multiple arguments.

Output

Entry
Meaning
AbsErr
if opts.DiffMode == 'off' empty, otherwise matrix of size p x (number samples) x (number systems-1), containing the computed absolute error values
Npts
positive integer, number of plotted points
RelErr
if opts.DiffMode == 'off' empty, otherwise matrix of size p x (number samples) x (number systems-1), containing the computed relative error values
X
if opts.StoreStates == 0 empty, otherwise cell array of length (number systems) containing matrices of size n x (number samples) with the computed states

See Also

ml_dt_dss_simulate | ml_ct_ss_simulate_ie