Detect Signal Clipping
Detect clipping in a captured waveform by finding runs of samples pinned at or near the full-scale limits, and report what fraction of the capture is affected.
Constraints
- Function: report = detect_clipping(x, full_scale).
- A run of 3 or more samples within 0.5 percent of full scale counts as clipping.
- Report the count of clipped regions and the total clipped samples.
- Report the percentage of the capture that is clipped.
- Handle both positive and negative clipping.
- A clean signal returns zero counts.
1function report = detect_clipping(x, full_scale)2% TODO3end