In this paper, based on the partial discharge ultrasonic signals of four typical discharge types of needle plate discharge, internal discharge, suspension discharge and creeping discharge in the switchgear, the time-frequency diagram of the ultrasonic signal is obtained by using the short-time Fourier transform, and the time-frequency is used by the sparse representation algorithm. The classification is performed to quickly and accurately determine whether a partial discharge has occurred and to determine which type of discharge it belongs to. In the process of using the sparse representation method, the orthogonal matching pursuit method and the accelerated near-end gradient method are used to solve the sparse solution respectively. The conditions applicable to the two methods are illustrated by experiments.