Discrete State-Space
DiscreteThe DiscreteStateSpace block models linear time-invariant (LTI) systems in discrete-time state-space representation. At each discrete sample interval , the block updates an internal state vector using the state-transition matrix and input coupling matrix , then computes the output vector using the output matrix and feedthrough matrix .
This block features an interactive augmented matrix spreadsheet editor ([A | B; C | D]) in the Property Editor, allowing you to add or remove states (), inputs (), and outputs () visually while automatically resizing coupled matrices and the initial state vector . It also provides live unit-circle eigenvalue stability analysis (), controllability/observability diagnostics, and a full Advanced State-Space Analysis Dashboard.
Mathematical Model
The discrete-time linear state-space difference equations are:
where:
- is the state vector at discrete time step .
- is the input vector.
- is the output vector.
- is the discrete state-transition matrix.
- is the input matrix.
- is the output measurement matrix.
- is the direct feedthrough matrix.
- is the integer sample index ().
The equivalent pulse transfer function matrix in the complex -plane is:
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | u |
Input(s) | number | Required |
| ← Out | y |
Output(s) | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
A |
A Matrix | vector | 0.9 |
|
B |
B Matrix | vector | 1 |
|
C |
C Matrix | vector | 1 |
|
D |
D Matrix | vector | 0 |
|
initialState |
Initial State | vector | 0 |
|
sampleTime |
Sample Time | number | 0.01 |
Usage Examples
Example 1: Discretized First-Order RC Filter
A continuous first-order lowpass filter discretized via zero-order hold with time constant s and sample period s. With , , , and , the discrete block precisely tracks the continuous exponential step response without numerical drift.
Example 2: Discrete Double-Integrator Motion Model
A kinematic positioning mechanism with states (position and velocity) driven by acceleration command . Specifying s, , , , and . Feeding a step acceleration input yields a smooth parabolic position trajectory.
Remarks & Best Practices
- Interactive Matrix Grid & Dashboard: Use the
+/−dimension controls in the Property Editor to add or remove states, inputs, and outputs without manually counting semicolons, and click Open Advanced Analysis Dashboard to inspect discrete step response, Bode plot, and -plane pole-zero locations. - Asymptotic Stability: The discrete system is asymptotically stable if and only if all eigenvalues of lie strictly within the unit circle of the complex plane (). Eigenvalues on or outside the unit circle produce oscillatory or diverging responses.
- Dimensional Compatibility: The dimensions must satisfy: is , has rows, has columns, and has dimensions .
- Direct Feedthrough and Algebraic Loops: When , the block creates an instantaneous algebraic path from input to output. If placed in an un-delayed feedback loop, an algebraic loop may occur.
- Sample Rate Coordination: Always align
sampleTimewith connected discrete blocks or useRateTransitionblocks to safely cross sample-rate domains.
Related Components
- StateSpace: Continuous-time linear state-space block integrated by the ODE solver.
- DiscreteTransferFunction: Pulse transfer function representation .
- RateTransition: Safe rate-buffering element between different sample time domains.
- UnitDelay: Fundamental single-sample discrete delay block ().