dutyCycle function

Calculate the duty cycle of a wave