PIXELBANKv9.1.0
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โ‹…ฮ”โˆ’1Aโ‹…B\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), โˆ’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
๐Ÿ”’

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

0/0
Run code to see test results.
Discretize Continuous State Space Model - Hard | PixelBank