First Order Hold
Linearly extrapolated first-order retention for the input signal.
Description
The First Order Hold block generates a continuous piecewise linear approximation of the input signal.
Use the First Order Hold block to convert a discrete signal into a continuous signal without additional solver settings.
You can also use First Order Hold to break algebraic loops in your model.
Ports
Parameters
Initial output - initial output
0 (by default)
| scalar
| vector
| N-dimensional array
Specify the output value that the block generates until the simulation time exceeds the first sampling time of the discrete input.
Dependencies
-
The initial output of this block cannot be
inf
orNaN
.
Block parameter |
|
Value |
|
By default |
|
Output algorithm - output approximation method
Slow (Avoid Overshoot) (By default)
| Fast (Minimise Error)
Specify the approximation method used to generate the output signal.
The slow low frequency algorithm (Slow (Avoid Overshoot))
avoids an output signal that does not match the input signal.
The fast high frequency algorithm Fast (Minimise Error)
minimizes the error in the approximated output signal, but may result in an output signal that does not match the input signal.
Block parameter |
|
Type |
|
Value |
|
* By default* |
|
Reset if relative extrapolation error exceeds - allowable error when resetting the solver
Inf (by default)
| non-negative real scalar
| vector
Specify the tolerance level for the extrapolation error of the inference algorithm.
The Inf value for the Allow continuous input parameter may lead to numerical inaccuracies in the simulation.
|
Block parameter |
|
Type |
|
Value |
|
By default |
|
Allow continuous input - allow continuous signals
off (by default)
| on
Select this option to allow the unit to accept continuous signals as input.
Enabling this parameter creates a delay between the input and output continuous signals.
Enable this option if you are using this unit to break algebraic loops. |
Block parameter |
|
Value |
|
* By default* |
|
Algorithms
Slow (Avoid overshoot)
Linear extrapolation performed by a slow or low frequency algorithm can be described as:
where
-
- is the time at -th major step;
-
- input signal at -th large step;
-
and - linear extrapolation coefficients;
-
- continuous output signal at time .
The coefficients (slope angle and -delay ) are calculated as follows:
Fast (Minimize Error)
Linear extrapolation performed by a fast, or high-frequency, algorithm can be described as:
where
-
- is the time at -th major step;
-
- input at -m major step;
-
- predicted value of the input signal at -m major step;
-
and - linear extrapolation coefficients;
-
- continuous output signal at the moment of time .
The coefficients (slope and -delay ) are calculated as follows:
The fast algorithm minimises the error by trying to predict the next input signal while calling the block update method. The error minimisation in the predicted block output is compensated by the tendency to overestimate the input signal.