midcross
The intersection of the average reference level for a two-level signal.
| Library |
|
Syntax
Function call
-
c = midcross(x)— returns the time points when each transition of the input signalxintersects50`The % reference level. To determine the transitions, the function `midcrossevaluates the state levelsxusing the histogram method, it identifies all intervals that intersect the upper boundary of the lower state and the lower boundary of the upper state.
-
c = midcross(x,Name,Value)— returns the time points corresponding to the intersections of the average reference level, with additional parameters specified by one or more arguments of the "name-value" type.
-
midcross(___;out=:plot)— plots the signal and marks the location of the intersection points with the reference level (the moments of the average reference levels) and the corresponding reference levels. The function also plots the state levels with the upper and lower boundaries of the state.
Arguments
Input arguments
# x is a two— level signal
+
vector
Details
A two-level signal defined as a real vector. The first sampling moment in x respond .
#
Fs —
sampling
rate
scalar
Details
The sampling frequency, specified as a positive real scalar, expressed in Hz.
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.
# MidPercentReferenceLevel — the average reference level
+
50 (by default) | scalar
Details
The average reference level as a percentage of the signal amplitude, set as a real scalar. For more information, see The average reference level.
# StateLevels — lower and upper state levels
+
vector
Details
The levels of the lower and upper states, defined as a real vector of size 1 on 2. The first element corresponds to the lower state level, and the second element corresponds to the upper state level of the input signal. If the argument is StateLevels not specified, function midcross evaluates the state levels based on the input signal using the histogram method.
# Tolerance — tolerance levels
+
2 (by default) | scalar
Details
Tolerance levels (boundaries of the lower and upper states), set as a real scalar, expressed as a percentage. For more information, see State level tolerances.
# out — type of output data
+
:data (by default) | :plot
Details
Type of output data:
-
:data— the function returns data; -
:plot— the function returns a graph.
Output arguments
# c — points in time
+
vector
Details
The time points of the intersection of the average reference level, returned as a vector.
Because the function midcross uses interpolation to determine the moment of intersection, the output argument is c it may contain values that do not correspond to the sampling points.
|
# midlev — the average reference level
+
scalar
Details
The average reference level returned as a scalar.
Additional Info
The average reference level
Details
The average reference level in a two-level signal with a lower state level and the upper state level equal to
The moment of the average reference level
Details
The moment of the average reference level is
where
-
indicates the average reference level;
-
and denote two consecutive sampling moments corresponding to the values of the signal closest in value to ;
-
and denote the values of the signal at the moment and .
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.