Method of mdss.
Convert a continuous-time mdss model to discrete
time.
Source: src/model/@mdss/c2d.m
sysd = c2d(sysc, Ts)
sysd = c2d(sysc, Ts, method)c2d discretizes the continuous-time model
sysc (which must have timeStepSize == 0) with
sample time Ts > 0. The state derivative is replaced by
a finite-difference approximation, which is implemented by manipulating
the structure and parameter matrices directly: an auxiliary variable and
equation are added for each state, and any that can be eliminated
algebraically are removed via algebraicElimination.
The result carries timeStepSize = Ts and records the chosen
discretizationType.
The method selects the approximation:
method |
Rule |
|---|---|
"forward" (default) |
Forward Euler: |
"backward" |
Backward Euler |
"tustin" |
Trapezoidal — not yet implemented |
| Argument | Description |
|---|---|
sysc |
Continuous-time mdss model
(timeStepSize == 0). |
Ts |
Discrete sample time, Ts > 0. |
method |
(optional) "forward" (default),
"backward", or "tustin". |
| Output | Description |
|---|---|
sysd |
Discrete-time mdss model with
timeStepSize = Ts, the state derivative replaced by the
chosen one-step Euler update, and eliminable auxiliary equations
removed. |
sysc = stringParser.symbolicToMdss(["xp1 = x2"; ...
"xp2 = -x1 - 0.5*x2"], 0);
sysd = c2d(sysc, 0.1); % forward Euler
sysdb = c2d(sysc, 0.1, "backward"); % backward EulerMyToolbox Documentation | Generated automatically by CI/CD pipeline