First Order Hold
Implement linearly extrapolated first order hold on input signal
Libraries:
Simulink /
Continuous
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 sampled discrete signal to a continuous signal without triggering a solver reset.
You can also use the First Order Hold block to break algebraic loops in your model.
Ports
Input
Port 1 — Input signal
scalar | vector | matrix
Input signal, specified as a real scalar, vector, or matrix.
Data Types: double
Output
Port 1 — Linearly approximated output signal
scalar | vector | matrix
Piecewise linear approximation of the input signal.
Data Types: double
Parameters
Initial output — Initial output
0
(default) | scalar | vector
Specify the output that the block generates until the simulation time exceeds the first sample hit time of the discrete input.
Dependencies
The initial output of this block cannot be
inf
orNaN
.A
Run-to-run tunable parameter
cannot be changed during simulation run time. However, changing it before a simulation begins does not cause Accelerator or Rapid Accelerator to regenerate code.
Programmatic Use
Block Parameter: InitialOutput |
Type: character vector, string |
Values: scalar | vector |
Default: '0' |
Output algorithm — Output signal approximation technique
Slow (Avoid Overshoot)
(default) | Fast (Minimize Error)
Specify the approximation technique used to generate the output signal. The slow, low pass algorithm avoids overshooting the input signal. The fast, high pass algorithm minimizes error in the approximated output but can overshoot the input signal.
Programmatic Use
Block Parameter:
OutputAlgorithm |
Type: character vector, string |
Values:
Slow (Avoid Overshoot) | Fast (Minimize
Error) |
Default:
'Slow (Avoid Overshoot)' |
Reset if relative extrapolation error exceeds — Error tolerance for solver reset
inf
(default) | non-negative real scalar
Specify the tolerance level for the extrapolation error of the output algorithm. Extrapolation error greater than the specified value causes Simulink® to reset the solver for the model.
Tip
Enabling the Allow continuous input parameter
when this parameter is set to inf
can lead to
numerical inaccuracies in simulation.
Programmatic Use
Block Parameter:
ErrorTolerance |
Type: character vector, string |
Values: scalar |
Default:
'inf' |
Allow continuous input — Apply hold on continuous signals
off
(default) | on
Select this parameter to enable the block to accept continuous signals as input. Enabling this parameter creates a delay between the input and output continuous signals.
Note
Enable this parameter when using this block to break an algebraic loop.
Programmatic Use
Block Parameter:
AllowContinuousInput |
Type: character vector, string |
Values:
'off' | 'on' |
Default:
'off' |
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Algorithms
Slow (Avoid overshoot)
The linear extrapolation performed by the slow or low pass algorithm can be described as:
where:
Tk is the time at the kth major step.
Uk is the input at the kth major step.
Ck and Mk are the linear extrapolation coefficients.
yk is the continuous output at time Tk.
The coefficients, or slope Mk and y-intercept Ck, are calculated as follows
Fast (Minimize Error)
The linear extrapolation performed by the fast, or high pass, algorithm can be described as:
where:
Tk is the time at kth major step.
Uk is the input at kth major step.
is the predicted value of the input at (k+1)th major step.
(Ck and Nk are the linear extrapolation coefficients.
yk is the continuous output at time Tk.
The coefficients, or slope Nk and y-intercept Ck, are calculated as follows
The fast algorithm minimizes error by attempting to predict the next input during the update method of the block. This error reduction in predicted output of the block is traded off against a tendency to overshoot the input signal.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Not recommended for production code generation.
Consider discretizing your model.
Version History
Introduced in R2019b
See Also
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)