# LabVIEW

cancel
Showing results for
Search instead for
Did you mean:

## How can I create a pulse train with varying pulse widths?

I'm trying to create a finite pulse train that varies its duty cycle. I was hoping there was a clever way to do this neatly. I've attached a very rough picture of the train I'm hoping to make, with the pulse widths defined with t, the delay between pulses d, and a total of N+1 pulses. Thanks!

Edit: My current method is to use the pulse train function, and actually create 2N+1 pulses, stacking the "double length" pulses.

Message 1 of 5
(2,174 Views)

## Re: How can I create a pulse train with varying pulse widths?

This pseudo code should do the trick.

pulse train (time,t,d)

cycle=floor(time/d)

timeintocycle=time-cycle*d

if timeintocycle<=(cycle+1)*t return high else return low

end function

Message 2 of 5
(2,139 Views)

## Re: How can I create a pulse train with varying pulse widths?

I wound up just building the first short pulse, and then the train of longer pulses, and sticking them together. I attached a screenshot of the code I went with.

Message 3 of 5
(2,118 Views)

## Re: How can I create a pulse train with varying pulse widths?

Hey don't go overboard with the gratitude.

Message 4 of 5
(2,105 Views)

## Re: How can I create a pulse train with varying pulse widths?

Like going overboard with the local variables. None of those are necessary.
Message 5 of 5
(2,101 Views)