pulseperiod
The period of a two-level pulse.
| Library |
|
Syntax
Function call
-
p = pulseperiod(x)— returns the difference between the moments of the initial transition of each pulse of positive polarity relative to the average reference level and the next positive transition in the two-level signalx. To determine the transitions that make up each pulse, the functionpulseperiodevaluates the state levels of the input signal using the histogram method and determines all areas crossing the upper boundary of the lower state and the lower boundary of the upper state.
-
p,initcross,finalcross = pulseperiod(___)— returns momentsfinalcrossthe average reference level of the final transition of each pulse.
-
p,initcross,finalcross,nextcross = pulseperiod(___)— returns momentsnextcrossthe average reference level of the next detected transition after each pulse.
-
p,initcross,finalcross,nextcross,midlev = pulseperiod(___,Name,Value)— returns pulse periods with additional parameters specified by one or more name-value arguments.
-
pulseperiod(___, out=:plot)— plots the signal and darkens every second identified pulse. The function marks the position of the middle intersections and their corresponding reference level. The function also plots state levels and the associated lower and upper bounds. The boundaries can be adjusted using a name-value argument."Tolerance".
Arguments
Input arguments
# x is a two— level signal
+
the real vector
Details
A two-level signal defined as a real vector. If x it does not contain at least two transitions, the function returns an empty matrix. The first moment in time in x respond .
#
Fs —
sampling
rate
positive real 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 scalar. For more information, see The average reference level.
# Polarity — the polarity of the pulse
+
"positive" (default) | "negative"
Details
The polarity of the pulse, set as "positive" or "negative". If specified "positive" the function searches for pulses with positive initial transitions (positive polarity). If specified "negative" the function searches for pulses with negative initial transitions (negative polarity). For more information, see Pulse polarity.
# StateLevels — lower and upper state levels
+
the real vector
Details
The levels of the lower and upper states, defined as a vector of real values with the 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 (by default) | :data
Details
Type of output data:
-
:plot— the function returns a graph; -
:data— the function returns data.
Output arguments
# p — pulse period
+
vector
Details
The pulse period in seconds, returned as a vector. The pulse period is defined as the time between the moments of the average reference level of two consecutive transitions. If the function does not find two positive polarity transitions, p it remains empty.
Because pulseperiod uses interpolation to determine the moments of the average reference level, p It may contain values that do not correspond to the sampling moments of the two-level signal. x.
|
# initcross — the moments of the average reference level of the initial transition
+
vector
Details
The moments of the average reference level of the initial transitions, returned as a vector.
# finalcross — the moments of the average reference level of the final transition
+
vector
Details
The moments of the average reference level of the end transitions, returned as a vector.
# nextcross — the moments of the average reference level of the initial transition after the final transition of the previous pulse
+
vector
Details
The moments of the average reference level of the initial transition after the final transition of the previous pulse, returned as a vector.
# midlev — signal value
+
scalar
Details
The signal value corresponding to 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
-
Let indicates the average reference level.
-
Let and denote two consecutive sampling moments corresponding to the values of the signal closest in value to .
-
Let and denote the values of the signal at the moment and .
The moment of the average reference level is
Pulse polarity
Details
If the initial transition of the pulse is positive, the pulse has a positive polarity. This figure shows a positive polarity pulse.
Similarly, an impulse of positive polarity (with a positive increase) has an end state greater than the initial one.
If the initial transition of the pulse is negative, the pulse has a negative polarity. This figure shows a negative polarity pulse.
In other words, an impulse of negative polarity (with a negative increase) has an initial state greater than the final one.
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.