Main Content

pulsesep

Separation between bilevel waveform pulses

Description

S = pulsesep(x) returns the differences between the mid-reference level instants of the final negative-going transitions of every positive-polarity pulse and the next positive-going transition. To determine the transitions that compose each pulse, the pulsesep function estimates the state levels of the input waveform by a histogram method. The function identifies all regions that cross the upper-state boundary of the low state and the lower-state boundary of the high state.

S = pulsesep(x,Fs) specifies the sample rate Fs.

example

S = pulsesep(x,t) specifies the sampling instants t.

[s,initcross] = pulsesep(___) returns the mid-reference level instants initcross of the first positive-polarity transitions. You can specify an input combination from any of the previous syntaxes.

[s,initcross,finalcross] = pulsesep(___) returns the mid-reference level instants finalcross of the final transition of each pulse.

example

[s,initcross,finalcross,nextcross] = pulsesep(___) returns the mid-reference level instants nextcross of the next detected transition after each pulse.

[s,initcross,finalcross,nextcross,midlev] = pulsesep(___) returns the mid-reference level midlev.

[s,initcross,finalcross,nextcross,midlev] = pulsesep(___,Name,Value) returns the pulse separations with additional options specified by one or more name-value arguments.

example

pulsesep(___) plots the signal and darkens the regions between each pulse where pulse separation is computed. The function marks the location of the mid crossings and their associated reference level. The function also plots the state levels and their associated lower and upper boundaries. You can adjust the boundaries using the 'Tolerance' name-value argument.

Examples

collapse all

Compute the pulse separation in a bilevel waveform with two positive-polarity transitions. The sample rate is 4 MHz.

load('pulseex.mat','x','t')

s = pulsesep(x,t)
s = 3.5014e-06

Plot the waveform and annotate the pulse separation.

pulsesep(x,t);

Figure Pulse Separation Plot contains an axes object. The axes object contains 10 objects of type patch, line. These objects represent pulse separation, signal, mid cross, upper boundary, upper state, lower boundary, mid reference, lower state.

Determine the mid-reference level instants that define the pulse separation for a bilevel waveform.

load('pulseex.mat','x','t')

[~,~,finalcross,nextcross] = pulsesep(x,t)
finalcross = 4.6256e-06
nextcross = 8.1270e-06

Return the pulse separation. Annotate the mid-reference level instants on a plot of the data.

pulsesep(x,t)

Figure Pulse Separation Plot contains an axes object. The axes object contains 10 objects of type patch, line. These objects represent pulse separation, signal, mid cross, upper boundary, upper state, lower boundary, mid reference, lower state.

ans = 3.5014e-06

Input Arguments

collapse all

Bilevel waveform, specified as a real-valued vector. If the waveform does not contain at least two transitions, the function outputs an empty matrix. The first time instant in x corresponds to t=0.

Sample rate, specified as a positive real scalar in hertz.

Sample instants, specified as a vector. The length of t must equal the length of the input bilevel waveform x.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: p = pulsesep(x,t,Polarity="negative")

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: p = pulsesep(x,t,'Polarity',"negative")

Mid-reference level as a percentage of the waveform amplitude, specified as scalar. For more information, see Mid-Reference Level.

Pulse polarity, specified as "positive" or "negative". If you specify "positive", the function looks for pulses with positive-going (positive polarity) initial transitions. If you specify "negative", the function looks for pulses with negative-going (negative polarity) initial transitions. For more information, see Pulse Polarity.

Low- and high-state levels, specified as a 1-by-2 real-valued vector. The first element is the low-state level and the second element is the high-state level. If you do not specify 'StateLevels', the function estimates the state levels from the input waveform using the histogram method.

Tolerance levels (lower- and upper-state boundaries), specified as a scalar and expressed as a percentage. The low-state and high-state boundaries 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.

Output Arguments

collapse all

Pulse separations in seconds, returned as a vector. The pulse separation is defined as the time between the mid-reference level instants of the final transition of one pulse and the initial transition of the next pulse. For more information, see Pulse Separation.

Note

Because pulsesep uses interpolation to determine the mid-reference level instants, s may contain values that do not correspond to sampling instants of the bilevel waveform x.

Mid-reference level instants of the initial transition, returned as a vector.

Mid-reference level instants of the final transition, returned as a vector.

Mid-reference level instants of the initial transition after the final transition of the preceding pulse, returned as a vector.

Waveform value that corresponds to the mid-reference level, returned as a scalar.

More About

collapse all

Mid-Reference Level

The mid-reference level in a bilevel waveform with low-state level S1 and high-state level S2 is

S1+12(S2S1)

Mid-Reference Level Instant

  • Let y50% denote the mid-reference level.

  • Let t50%- and t50%+ denote the two consecutive sampling instants corresponding to the waveform values nearest in value to y50%.

  • Let y50%- and y50%+ denote the waveform values at t50%- and t50%+.

The mid-reference level instant is

t50%=t50%+(t50%+t50%y50%+y50%)(y50%+y50%)

Pulse Polarity

If the pulse has an initial positive-going transition, the pulse has positive polarity. This figure shows a positive-polarity pulse.

Equivalently, a positive-polarity (positive-going) pulse has a terminating state more positive than the originating state.

If the pulse has an initial negative-going transition, the pulse has negative polarity. This figure shows a negative-polarity pulse.

Equivalently, a negative-polarity (negative-going) pulse has a originating state more positive than the terminating state.

State-Level Tolerances

You can specify lower- and upper-state boundaries for each state level. Define the boundaries as the state level plus or minus a scalar multiple of the difference between the high state and the low state. To provide a useful tolerance region, specify the scalar as a small number such as 2/100 or 3/100. In general, the $\alpha\%$ region for the low state is defined as

$$S_1\pm{\alpha\over{100}}(S_2-S_1),$$

where $S_1$ is the low-state level and $S_2$ is the high-state level. Replace the first term in the equation with $S_2$ to obtain the $\alpha\%$ tolerance region for the high state.

This figure shows lower and upper 5% state boundaries (tolerance regions) for a positive-polarity bilevel waveform. The thick dashed lines indicate the estimated state levels.

Pulse Separation

Pulse separation is the time difference between the mid-reference level instant of the final transition of one pulse and the mid-reference level instant of the initial transition of the next pulse. This figure illustrates pulse separation.

References

[1] IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2012a