c2d

Method of mss.

Convert a continuous-time MTI system to a discrete-time MTI system.

Source: src/model/@mss/c2d.m

Syntax

sysd = c2d(sysc, Ts)
sysd = c2d(sysc, Ts, method)

Description

c2d discretizes the continuous-time explicit model

ẋ=f(x,u),y=g(x,u) \dot x = f(x,u), \qquad y = g(x,u)

with sample time Ts > 0. The model must be continuous (timeStepSize == 0), otherwise the call errors with “The mss model is already discrete.”

The method decides both the approximation and the class of the result:

method Rule Result
"forward" (default) Forward Euler, xk+1=xk+Tsf(xk,uk)x_{k+1} = x_k + T_s f(x_k,u_k) mss — stays explicit
"backward" Backward Euler mdss — implicit, warns
"tustin" Trapezoidal mdss — implicit, warns

Only forward Euler preserves the explicit multilinear structure: the successor state is still an explicit multilinear function of (xk,uk)(x_k,u_k). Backward Euler and Tustin make xk+1x_{k+1} appear on both sides, so the model is converted with mss2mdss and handed to c2d of the mdss class, after issuing a warning that the return type changed. In this case, if the mtiBase of sysc was the literal base, the model base is not preserved because the mdss class does not yet support literal base models.

How forward Euler is built

The discretization is applied directly to the CPN matrices rather than symbolically. With SS the structure matrix and ΦF,ΦG\Phi_F,\Phi_G the state and output parameter blocks, one monomial column per state is appended — each selecting a single state — and the parameter matrix is extended so that the state block reads [TsΦFI][\,T_s\Phi_F\ \ I\,] and the output block [ΦG0][\,\Phi_G\ \ 0\,]:

Sd=[S[I0]],Φd=[TsΦFIΦG0], S_d = \big[\,S\ \ \big[\begin{smallmatrix}I\\0\end{smallmatrix}\big]\,\big], \qquad \Phi_d = \begin{bmatrix} T_s\Phi_F & I \\ \Phi_G & 0\end{bmatrix},

which is exactly xk+1=xk+Tsf(xk,uk)x_{k+1} = x_k + T_s f(x_k,u_k), yk=g(xk,uk)y_k = g(x_k,u_k). Signal names are carried over and the result is cleaned up with trivialReduction.

On the TTTensor path the same forward-Euler step is performed by scaling the state-equation rows of the first core by Ts and adding an identity tensor train. That path always applies forward Euler — method is not consulted — and it neither copies signal names nor runs trivialReduction.

Input arguments

Argument Description
sysc Continuous-time mss model (timeStepSize == 0).
Ts Sample time, Ts > 0.
method (optional) "forward" (default), "backward" or "tustin".

Output arguments

Output Description
msys Discrete-time model: an mss for "forward", an mdss for "backward" / "tustin".

Example

sysc = rmss(3,1,1,4);          % random continuous-time model
sysd = c2d(sysc, 0.01);        % forward Euler, still an mss

sysi = c2d(sysc, 0.01, "backward");   % warns; returns an mdss

See also

d2c · mss · msim · trivialReduction · mss2mdss · c2d


MyToolbox Documentation | Generated automatically by CI/CD pipeline