Continuous

StateSpace Block

State-space realization: x'=Ax+Bu, y=Cx+Du with A,B,C,D matrices

Open StateSpace in BlockWerk →

# StateSpace Block Documentation

Overview

The StateSpace block implements a general state-space linear system described by matrices A, B, C, D:

x' = Ax + Bu    (state equation)
y  = Cx + Du    (output equation)

This is the most general form of linear time-invariant (LTI) systems and is fundamental to modern control theory.

Mathematical Model

ẋ = Ax + Bu
y = Cx + Du

where:

Where:

Inputs

Outputs

Parameters

A Matrix (State)

B Matrix (Input)

C Matrix (Output)

D Matrix (Feedthrough)

Initial State

Matrix Format Examples

2×2 State Matrix

1 -2
0 -3

2×1 Input Matrix (2 states, 1 input)

0
1

1×2 Output Matrix (1 output, 2 states)

1 0

Examples

Example 1: First-Order System

A simple exponential decay system with time constant τ = 1:

Parameters:

This represents: ẋ = -x + u, y = x (or any state)

Example 2: Second-Order Mass-Spring System

m·ẍ + c·ẋ + k·x = u

Let x₁ = position, x₂ = velocity. Then:

ẋ₁ = x₂
ẋ₂ = -k/m·x₁ - c/m·x₂ + 1/m·u
y = x₁ (output position)

Parameters (m=1, c=2, k=1):

Example 3: MIMO System (2 inputs, 2 outputs)

A: "0 1 0; 0 0 1; -2 -3 -1"
B: "0 0; 1 0; 0 1"
C: "1 0 0; 0 1 0"
D: "0 0; 0 0"

Common Use Cases

1. Control system design: Implement controllers, observers, compensators 2. Filter design: Digital and analog filters 3. Simulation of mechanical systems: Robot dynamics, vehicle models 4. Power systems: Electrical machine models 5. Aerospace: Aircraft dynamics, satellite attitude control

Numerical Integration

The block uses forward Euler integration for simplicity and stability in most cases:

x[k+1] = x[k] + ẋ[k] · dt

For better accuracy with large sample times, consider using a continuous transfer function approach or a more sophisticated integrator.

Dimension Requirements

The matrices must satisfy strict dimension constraints:

If dimensions are inconsistent, the block outputs 0 and skips computation. Verify matrix dimensions match before running the simulation.

Stability Constraints (Forward Euler)

The block uses Forward Euler integration. For stability:

Performance Considerations

Remarks

See Also