Comparison of a PWM inverter and a multilevel inverter using the switching function analysis for harmonic content and efficiency