Analysis and measurement of PWM waveforms