Abstract: There is described a method and apparatus for substantially cancelling harmonic distortion from the output voltage signal of a power supply. The system samples the output of the power supply and detects the harmonic distortion within the output signal. After the harmonic distortion is detected, the amplitude of the real and imaginary components of the harmonic distortion are determined. The amplitude components are applied to a PI compensator to generate the harmonic distortion correction signal necessary to substantially cancel harmonic distortion from the output voltage signal. The harmonic distortion correction signal is then applied to the power supply.