You are here : matlabSignal Processingpulseperiod

# pulseperiod() - Signal Processing

```P = pulseperiod(X)
returns a vector, P, containing the difference
between the mid-reference level instants of the initial transition
of each positive-polarity pulse and the next positive-going transition
in the bilevel waveform, X. If pulseperiod does
not find two positive-polarity transitions, P is
empty. To determine the transitions for each pulse, pulseperiod estimates
the state levels of the input waveform by a histogram method and identifies
all regions which cross the upper-state boundary of the low state
and the lower-state boundary of the high state. 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. See State-Level Tolerances. Because pulseperiod uses
interpolation to determine the mid-reference level instants, P may
contain values that do not correspond to sampling instants of the
bilevel waveform, X.P = pulseperiod(X,FS) specifies
the sampling rate in hertz as a positive scalar. The first sample
instant in X corresponds to t=0.
Because pulseperiod uses interpolation to determine
the mid-reference level instants, P may contain
values that do not correspond to sampling instants of the bilevel
waveform, X.P = pulseperiod(X,T) specifies
the sampling instants in a vector equal in length to X.
Because pulseperiod uses interpolation to determine
the mid-reference level instants, P may contain
values that do not correspond to sampling instants of the bilevel
waveform, X.[P,INITCROSS]
= pulseperiod(...) returns the mid-reference level instants
of the first transition of each pulse.[P,INITCROSS,FINALCROSS]
= pulseperiod(...) returns the mid-reference level instants
of the final transition of each pulse.[P,INITCROSS,FINALCROSS,NEXTCROSS]
= pulseperiod(...) returns the mid-reference level instants
of next detected transition after each pulse.[P,INITCROSS,FINALCROSS,NEXTCROSS,MIDLEV]
= pulseperiod(...) returns the mid-reference level,MIDLEV. [P,INITCROSS,FINALCROSS,NEXTCROSS,MIDLEV]
= pulseperiod(...,Name,Value) returns
the pulse periods with additional options specified by one or more Name,Value pair
arguments.pulseperiod(...) plots the signal and darkens
every other identified pulse. It marks the location of the mid crossings,
and their associated reference level. The state levels and their associated
lower and upper boundaries (adjustable by the Name,Value pair
with name 'Tolerance') are also plotted.```

### Syntax

```P = pulseperiod(X)P = pulseperiod(X,FS)P = pulseperiod(X,T)[P,INITCROSS]
= pulseperiod(...)[P,INITCROSS,FINALCROSS]
= pulseperiod(...)[P,INITCROSS,FINALCROSS,NEXTCROSS]
= pulseperiod(...)[P,INITCROSS,FINALCROSS,NEXTCROSS,MIDLEV]
= pulseperiod(...)[P,INITCROSS,FINALCROSS,NEXTCROSS,MIDLEV]
= pulseperiod(...,Name,Value)pulseperiod(...)```

### Example

```Pulse Period of Bilevel WaveformOpen This Example
Compute the pulse period of a bilevel waveform with two positive-polarity transitions. The sample rate is 4 MHz.

p = pulseperiod(x,t)

p =

5.0030e-06

Annotate the pulse period on a plot of the waveform.pulseperiod(x,t);

Mid-Reference Level Instants of Pulse PeriodOpen This Example
Determine the mid-reference level instants that define the pulse period for a bilevel waveform.
[~,initcross,~,nextcross] = pulseperiod(x,t)

initcross =

3.1240e-06

nextcross =

8.1270e-06

Output the pulse period. Mark the mid-reference level instants on a plot of the data.pulseperiod(x,t)

ans =

5.0030e-06```