dutycycle

Duty cycle of pulse waveform

Syntax

D = dutycycle(X)
D = dutycycle(X,FS)
D = dutycycle(X,T)
D = dutycycle(TAU,PRF)
[D,INITCROSS] = dutycycle(X,...)
[D,INITCROSS,FINALCROSS] = dutycycle(X,...)
[D,INITCROSS,FINALCROSS,NEXTCROSS] = dutycycle(X,...)
[D,INITCROSS,FINALCROSS,NEXTCROSS,MIDLEV] = dutycycle(X,...)
[D,INITCROSS,FINALCROSS,NEXTCROSS] = dutycycle(X,...,Name,Value)
dutycycle(X,...)

Description

D = dutycycle(X) returns the ratio of pulse width to pulse period for each positive-polarity pulse. D has length equal to the number of pulse periods in X. The sample instants of X correspond to the indices of X. To determine the transitions that define each pulse, dutycycle estimates the state levels of the input waveform by a histogram method. dutycycle 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.

D = dutycycle(X,FS) specifies the sampling frequency, FS, in hertz as a positive scalar. The first sample instant of X corresponds to t=0.

D = dutycycle(X,T) specifies the sample instants, T, as a vector with the same number of elements as X.

D = dutycycle(TAU,PRF) returns the ratio of pulse width to pulse period for a pulse width of TAU seconds and a pulse repetition frequency of PRF. The product of TAU and PRF must be less than or equal to 1.

[D,INITCROSS] = dutycycle(X,...) returns a vector, INITCROSS, whose elements correspond to the mid-crossings (mid-reference level instants) of the initial transition of each pulse with a corresponding NEXTCROSS.

[D,INITCROSS,FINALCROSS] = dutycycle(X,...) returns a vector, FINALCROSS, whose elements correspond to the mid-crossings (mid-reference level instants) of the final transition of each pulse with a corresponding NEXTCROSS.

[D,INITCROSS,FINALCROSS,NEXTCROSS] = dutycycle(X,...) returns a vector, NEXTCROSS, whose elements correspond to the mid-crossings (mid-reference level instants) of the next detected transition for each pulse.

[D,INITCROSS,FINALCROSS,NEXTCROSS,MIDLEV] = dutycycle(X,...) returns the mid-reference level, MIDLEV. Because in a bilevel pulse waveform the state levels are constant, MIDLEV is a scalar.

[D,INITCROSS,FINALCROSS,NEXTCROSS] = dutycycle(X,...,Name,Value) returns the ratio of pulse width to pulse period with additional options specified by one or more Name,Value pair arguments.

dutycycle(X,...) plots the waveform, X, and marks the location of the mid-reference level instants and the associated reference levels. The state levels and associated lower and upper state boundaries are also plotted.

Input Arguments

X

Bilevel waveform. X is a real-valued row or column vector.

FS

Sample rate in hertz.

T

Vector of sample instants. The length of T must equal the length of the bilevel waveform, X.

TAU

Pulse width in seconds. The product of TAU and PRF must be less than or equal to 1.

PRF

Pulse repetition frequency in pulses/second. The product of TAU and PRF must be less than or equal to 1.

Name-Value Pair Arguments

'MidPercentReferenceLevel'

Mid-reference level as a percentage of the waveform amplitude.

Default: 50

'Polarity'

Pulse polarity. Specify the polarity as 'positive' or 'negative'. If you specify 'positive', dutycycle looks for pulses with positive-going (positive polarity) initial transitions. If you specify 'negative', dutycycle looks for pulses with negative-going (negative polarity) initial transitions. See Pulse Polarity for examples of positive and negative-polarity pulses.

Default: 'positive'

'StateLevels'

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

'Tolerance'

Tolerance levels (lower- and upper-state boundaries) expressed as a percentage. See State-Level Tolerances.

Default: 2

Output Arguments

D

Duty cycle. Duty cycle is the ratio of the pulse width to the pulse period. Because the pulse width cannot exceed the pulse period, 0≤D ≤1.

INITCROSS

Mid-reference level instant of initial transition. Because the duty cycle is defined as the ratio of pulse width to pulse period, initial transitions are only reported when dutycycle finds a corresponding NEXTCROSS.

FINALCROSS

Mid-reference level instant of final transition. The duty cycle is defined as the ratio of pulse width to pulse period. Thus, final transitions are only reported when dutycycle finds a corresponding NEXTCROSS.

NEXTCROSS

Mid-reference level instant of the first initial transition after the final transition of the preceding pulse.

MIDLEV

Mid-reference level. The waveform value that corresponds to the mid-reference level.

Examples

expand all

Duty Cycle of Bilevel Waveform

Determine the duty cycle of a bilevel waveform. Use the vector indices as the sample instants.

load('pulseex.mat', 'x');
d = dutycycle(x);

Duty Cycle of Bilevel Waveform with Sampling Frequency

Determine the duty cycle of a bilevel waveform. The sampling frequency is 4 MHz.

load('pulseex.mat', 'x','t');
fs = 1/(t(2)-t(1));
d = dutycycle(x,fs);

Duty Cycle of Bilevel Waveform with Three Pulses

Create a pulse waveform with three pulses. The sampling frequency is 4 MHz. Determine the initial and final mid-reference level instants. Plot the result.

Even though there are three pulses, only two pulses have corresponding subsequent transitions.

load('pulseex.mat','x');
dt = 1/4e6;
ts = reshape(repmat(x(1:30),1,3),90,1);
t = 0:dt:(length(ts)*dt)-dt;
[d,initcross,finalcross,~,midlev] = dutycycle(ts,t);
plot(t,ts,'k'); hold on; grid on;
h0 = plot(initcross, midlev*ones(length(initcross)),'rx');
set(h0,'markersize',10,'linewidth',2.5);
h1 = plot(finalcross,midlev*ones(length(finalcross)),'bx');
set(h1,'markersize',10,'linewidth',2.5);

More About

expand all

Duty Cycle

The energy in a bilevel, or rectangular, pulse is equal to the product of the peak power, Pt, and the pulse width, τ. Devices to measure energy in a waveform operate on time scales longer than the duration of a single pulse. Therefore, it is common to measure the average power

Pav=PtτT,

where T is the pulse period.

The ratio of average power to peak power is the duty cycle:

D=Ptτ/TPt

Pulse Polarity

If the pulse has a positive-going initial transition, the pulse has positive polarity. The following 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 a negative-going initial transition, the pulse has negative polarity. The following 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

Each state level can have an associated lower- and upper-state boundary. These state boundaries are defined as the state level plus or minus a scalar multiple of the difference between the high state and low state. To provide a useful tolerance region, the scalar is typically a small number such as 2/100 or 3/100. In general, the α% tolerance region for the low state is defined as

S1±α100(S2S1)

where S1 is the low-state level and S2 is the high-state level. Replace the first term in the equation with S2 to obtain the α% tolerance region for the high state.

The following figure illustrates lower and upper 2% state boundaries (tolerance regions) for a positive-polarity bilevel waveform. The estimated state levels are indicated by a dashed red line.

References

[1] Skolnik, M.I. Introduction to Radar Systems. New York, NY: McGraw-Hill, 1980.

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

Was this topic helpful?