This paper proposes a new method of harmonic energy measurement based on atomic decomposition algorithm. Firstly, the matching pursuits (MP) algorithm is introduced and harmonic atom dictionary is designed according to the characteristics of signals to be analyzed to improve the effect of signal decomposition. Then, the MP algorithm is optimized by particle swarm optimization (PSO) to reduce the calculation amount. The simulation results of active harmonic energy in steady and unsteady state demonstrate feasibility and accuracy of the presented method.