02-16-2014 04:16 PM - edited 02-16-2014 04:43 PM
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.
02-16-2014 05:36 PM - edited 02-16-2014 06:06 PM
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
02-16-2014 07:31 PM
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.
02-16-2014 07:59 PM
Hey don't go overboard with the gratitude.
02-16-2014 08:10 PM