I have a waveform that's modulated by a trapezoidal function. I fitted the envelope to the expected function to show if the amplitude is modulated correctly.
I also plotted the difference of the fit and the envelope
This is an example of a fairly "healthy" waveform. Sometimes my amplifier likes to compress and decompress the output though, which results in a difference plot like this:
As you can see the difference doesn't seem to be continuous, and has sudden drops and rises. I want to be able to automatically detect these moments of compression/decompression. How do I show that the data is not "continuous" anymore?


