In the process of transient test, due to the insufficient bandwidth of the pressure sensor, the test data is inaccurate. Firstly, based on the projection of the shock tube test signal in the sparse domain, the feature expression of the signal sample is obtained. Secondly, the problem of insufficient bandwidth is solved by inverse modeling of sensor dynamic compensation system based on swarm intelligence algorithm. In this paper, the method is used to compensate the shock tube test signals of the 85XX series pressure sensors made by the Endevco company of the United States, the working bandwidth of the sensor is widened obviously, the rise time of the pressure signal can be compensated to 12.5 μs, and the overshoot can be reduced to 8.96%. The repeatability of dynamic compensation is verified for the actual gun muzzle shock wave test data, the results show that the dynamic compensation can effectively recover the important indexes such as overpressure peak value and positive pressure action time, and the original shock wave signal is recovered from the high resonance data.