I\'m trying to implement a rectangular pulse train in python.
I searched scipy and there is no signal that implements. http://docs.scipy.org/doc/scipy/reference/sign
All the answers are nice but I found they are having some problems with scipy.integrate so I created 3 types specially keeping in mind scipy.integrate:
def uniform_pulse_function(self, t, start, stop, pulsewidth, period, amplitude):
func = amplitude * np.where((t > start and t < stop and (t % period <(pulsewidth))),
1, 0)
func = (amplitude[int(t//period)])*np.where((t>start and t
def custom_pulse_function(self, t, start, stop, pulsewidth, period, amplitude):
func = (amplitude[int(t//period)]) * np.where((t > start and t < stop and (t % period < (pulsewidth[int(t//period)]))), 1, 0)
return func