PIXELBANKv8.2.1
Menu

Discretize Continuous State Space Model

Implement a discretization method for State Space Models originally defined in continuous time to accommodate discrete token sequences. This process is crucial for applying continuous-time models to real-world problems that involve discrete data.

The Continuous State Space Model is defined by the equations x(t)=Ax(t)+Bu(t)x'(t) = Ax(t) + Bu(t) and y(t)=Cx(t)y(t) = Cx(t), where x(t)x(t) is the state vector, u(t)u(t) is the input vector, and y(t)y(t) is the output vector. To discretize this model, we can use the Zero-Order Hold method, which assumes the input is constant between sampling times.

Here are the steps to discretize the model:

  1. Define the continuous-time model parameters AA, BB, and the sampling time Δ\Delta.
  2. Compute the discretized state transition matrix Aˉ\bar{A} and input coefficient Bˉ\bar{B}.
Aˉ=eAΔ\bar{A} = e^{A \cdot \Delta} Bˉ=eAΔ1AB\bar{B} = \frac{e^{A \cdot \Delta} - 1}{A} \cdot B

This technique is widely used in digital control systems.

Example:

Input:
A=-1.0, B=1.0, delta=0.1
Output:
(0.9048, 0.0952)
Reasoning:

A_bar = e^(-0.1) ≈ 0.9048. B_bar = (e^(-0.1) - 1) / (-1) × 1 ≈ 0.0952. The state decays by ~10% each step while accumulating input.

Constraints:

  • AA: Continuous state transition (scalar), 10A0-10 \leq A \leq 0
  • BB: Input coefficient (scalar), 0B100 \leq B \leq 10
  • Δ\Delta: Discretization step size, 0.01Δ2.00.01 \leq \Delta \leq 2.0
Editor

Test Results

0/0
Run code to see test results.