Discrete

DiscreteStateSpace Block

Discrete-time state-space realization: x[k+1]=Ax[k]+Bu[k], y[k]=Cx[k]+Du[k]

Open DiscreteStateSpace in BlockWerk →

# Discrete State-Space Block

Description

The Discrete State-Space block implements a discrete-time linear state-space system. At each sample instant it advances the internal state vector using the recurrence equations, then computes the output as a linear combination of the current state and input. The block is equivalent to the z-domain matrix transfer function H(z) = C(zI - A)^-1 B + D.

Typical uses include implementing discrete-time plant models, observer/estimator dynamics, pre-designed digital filters expressed in state-space form, and any linear system that has been discretised from a continuous-time design via zero-order hold or Tustin methods.

Mathematical Model

x[k+1] = A·x[k] + B·u[k]
y[k]   = C·x[k] + D·u[k]

Where:

Parameters

A

State-transition matrix. Enter as a space- or comma-separated list for a 1-D case, or use MATLAB-style row notation ([a11, a12; a21, a22]) for higher-order systems. Default: 0.9 (scalar, single-state integrator-like system).

B

Input matrix mapping the input vector to state derivatives. Dimensions must be compatible with A (n rows) and the number of input signals (m columns). Default: 1.

C

Output matrix mapping the state vector to outputs. Row count determines the number of output signals. Default: 1.

D

Direct-feedthrough matrix. Set to 0 for a strictly proper system (no instantaneous input-to-output path). Dimensions must match C rows × B columns. Default: 0.

initialState

Initial state vector x[0]. Must have length equal to the number of rows in A. Default: 0.

sampleTime

Sample period in seconds. All four matrix equations are evaluated once every sampleTime seconds. Must be a positive non-zero value. Default: 0.01 s (100 Hz).

Examples

First-order low-pass filter at 100 Hz

A discrete first-order low-pass with pole at z = 0.9, unit DC gain:

Step → DiscreteStateSpace → Display
       A=0.9  B=0.1  C=1  D=0  T=0.01s

Second-order system (double integrator, Euler)

Discretised double integrator with T = 0.01 s:

Force → DiscreteStateSpace → Position
        A=[1 0.01; 0 1]  B=[0.00005; 0.01]  C=[1 0]  D=0

Remarks

See Also