slewrate
The rate of rise of a two-level signal.
| Library |
|
Syntax
Function call
-
s = slewrate(x)— returns the rate of rise for all transitions found in the two-level signalx. To determine the transitions, the functionslewrateevaluates the state levels of the input signal using the histogram method and identifies all areas crossing the upper boundary of the lower state and the lower boundary of the upper state.
-
s,lt,ut = slewrate(___)— returns the time points when the signal crosses the lower percentage reference levelltand the upper percentage reference levelut. If the lower and upper percentage reference levels are not specified, the default values are10% and90%, respectively. You can specify an input combination of any of the above syntax options.
-
s = slewrate(___,Name,Value)— returns the rate of increase for all transitions with additional arguments specified by one or more arguments of the typeName,Value.
-
slewrate(___)— plots a two-level signal and darkens the areas of each transition where the rate of rise is calculated. The graph shows the intersections of the lower and upper reference levels, as well as the corresponding reference levels. The graph also shows the state levels and their corresponding lower and upper tolerances.
Arguments
Input arguments
# x is a two— level signal
+
the real vector
Details
A two-level signal defined as a real vector. If the input signal does not have at least one transition, the function returns an empty matrix. The first moment in time in x respond .
#
Fs —
sampling
rate
positive real scalar
Details
The sampling rate, specified as a positive real scalar, expressed in hertz.
Name-value input arguments
Specify optional argument pairs as Name,Value, where Name — the name of the argument, and Value — the appropriate value. Name-value arguments should be placed after other arguments, but the order of the pairs does not matter.
Use commas to separate the name and value, and Name put it in quotation marks.
# PercentReferenceLevels — percentage reference levels
+
[10,90] (by default) | the real vector
Details
Percentage reference levels, defined as a real vector of size 1 on 2. For more information, see [percentage-reference-levels].
# StateLevels — lower and upper state levels
+
the real vector
Details
The levels of the lower and upper states, defined as a real vector of size 1 on 2. The first element is the lower state level. The second element is the upper state level. If the parameter StateLevels not specified, the function evaluates the state levels based on the input signal using the histogram method.
# Tolerance — tolerance levels
+
2 (by default) | scalar
Details
Tolerance levels (the boundaries of the lower and upper states), set as a scalar, expressed as a percentage. The boundaries of the lower and upper states are expressed as the state level plus or minus a multiple of the difference between the state levels. For more information, see State-level tolerances.
# out — type of output data
+
:plot (default) | :data
Details
Type of output data:
-
:plot— the function returns a graph; -
:data— the function returns data.
Output arguments
# s — rate of increase
+
vector
Details
The rate of increase returned as a vector. A positive rate of increase indicates that the upper percentage reference level occurs later than the lower percentage reference level. A negative rate of increase indicates that the upper percentage reference level occurs earlier than the lower percentage reference level. The rate of rise is the slope of the line connecting 10% and 90% reference levels.
# lt — time points when the input signal crosses the lower percentage reference level
+
vector
Details
The time points when the input signal crosses the lower percentage reference level, returned as a vector.
# ut — time points when the input signal crosses the upper percentage reference level
+
vector
Details
The time points when the input signal crosses the upper percentage reference level, returned as a vector.
# ll — signal values at the lower reference level
+
vector
Details
The signal values at the lower percentage reference level, returned as a vector.
# ul — signal values at the upper reference level
+
vector
Details
The signal values at the upper percentage reference level, returned as a vector.
Additional Info
Percentage reference levels
Details
If — this is the lower state, — top condition, eh — the upper percentage reference level, then the signal value corresponding to the upper percentage reference level is
If — the lower percentage reference level, then the signal value corresponding to the lower percentage reference level is
The rate of increase
Details
The rate of increase is the slope of the line connecting the upper and lower percentage reference levels. Let indicates the time when the signal crosses the lower percentage reference level, and — the time when the signal crosses the upper percentage reference level. Using the definitions of the upper and lower percentage reference levels given in the [percentage-reference-levels] section, we determine the rate of increase:
If comes earlier , the rate of increase is positive. If comes earlier , the rate of increase is negative.
State-level tolerances
Details
You can specify the boundaries of the lower and upper states for each state level. Define boundaries as the level of states plus or minus a scalar value that is a multiple of the difference between the upper and lower states. To set a useful tolerance range, specify a scalar value as a small number, for example or . In the general case, the area for the lower state, it is defined as
where — the level of the lower state, and — the level of the upper state. Replace the first term in the equation with to get the tolerance area for the upper state level.