v9.1.1
Menu

Discretize Continuous State Space Model

hardPROVision MambaMath, Signal ProcessingAdvanced Architectures

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⋅Δ−1A⋅B\bar{B} = \frac{e^{A \cdot \Delta} - 1}{A} \cdot B

When A=0A = 0 the fraction for Bˉ\bar{B} is undefined; use its limit instead, Bˉ=B⋅Δ\bar{B} = B \cdot \Delta (and Aˉ=1\bar{A} = 1).

Return the tuple (Aˉ,Bˉ)(\bar{A}, \bar{B}) with both values rounded to 4 decimal places.

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
  • Inputs: A =−1=-1 is the continuous decay rate of the state, B =1=1 scales how strongly the input pushes the state, and delta Δ=0.1\Delta = 0.1 is the time between two tokens.
  • State transition: over one step the state decays by the factor Aˉ=eAΔ=e−0.1≈0.904837\bar{A} = e^{A\Delta} = e^{-0.1} \approx 0.904837, which rounds to 0.90480.9048.
  • Input coefficient: with the input held constant for the whole step, Bˉ=e−0.1−1−1⋅1=1−0.904837=0.095163\bar{B} = \frac{e^{-0.1} - 1}{-1} \cdot 1 = 1 - 0.904837 = 0.095163, which rounds to 0.09520.0952.
  • Output: the pair (0.9048, 0.0952), so one step of the discrete model reads xk=0.9048 xk−1+0.0952 ukx_k = 0.9048\,x_{k-1} + 0.0952\,u_k: about 9.5% of the old state fades and roughly that much input is absorbed.
  • Notice: Bˉ\bar{B} is close to BΔ=0.1B\Delta = 0.1. For small AΔA\Delta the fraction eAΔ−1A\frac{e^{A\Delta}-1}{A} approaches Δ\Delta, and that limit is exactly the value Bˉ/B\bar{B}/B takes when A=0A = 0.

Constraints

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

More from Advanced Architectures

PRO

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test results

Sign in to run your code against the test cases.