PWM rectifier with low DC voltage ripple for magnet supply