A two-step method to improve the sparse representation is proposed to estimate the dynamic harmonic impedance matrix under the underdetermined model.First measured on bus node harmonic voltage value,based on the two-dimensional sparse domain minimum deviation Angle of the change of the harmonic impedance matrix moment,and then estimates the dynamic change of the harmonic impedance matrix and obtain the real-time harmonic source number.Simulation verification of IEEE-14 node system was carried out through MATLAB simulation software to verify the accuracy and rationality of two-step algorithm for estimating harmonic impedance improved sparse representation.