Previous value of data
returns the value of the data at the previous time step. This operator works only in the
z = getPrevious(
alternative way to execute
z = prev(
u — Data
Data, specified as data defined in the Requirements Table block. See
Define Data in Requirements Table Blocks.
u must be specified as input or output data.
z — Value at previous time step
any data type, depending on the input
Value at the previous time step, returned as a value with the same data type of
Check Previous Data Values
At the start time, set
y equal to
0. After the
start time, recall the value of the input data
u in the precondition
at the previous time step. One requirement checks if the previous value of
u is greater than or equal to the current value, and another checks
if the previous value is less than the current value. The block assigns different values
for the output data
getPreviousattempts to return the value of the data at a time step when it was not defined, it returns an undefined value. For example, data is not defined before the simulation time is
0. For this situation, use the
isStartupoperator to define additional requirements at a simulation time of
~isStartupat the other time steps.
You can use this operator only in the Requirements tab.
Introduced in R2022a