I have a test rig which at short intervals samples the current drawn by a WiFi chip beaconing and sleeping between each beacon. The result is a good approximation to a square wave, with slight spiky irregularities or "whiskers" at the boundaries, but broadly speaking a series of plateaus (plateaux?!) of equal height.
I would like a simple numeric method to extract from the data the best fit "idealized" characteristics, mainly the average plateau height and width and sleeping gap between steps. I suppose deducing the period would be most of what is needed for a start.
This problem is probably only borderline on-topic here, if that, being near the interface of maths and computer algorithms. Also it is obvious up to a point how one might proceed, by dexterous use of averages. But there may be other situations where the wave form is not so simple, for example a sloping line instead of a plateau.
So I wondered if there might be a simple but more effective and robust approach than fiddling around with averages. although I probably wouldn't want anything too sophisticated such as Fast Fourier Transforms (if those might be appropriate). But I am open to and interested in any suggestions. So now's your chance to solve a real industrial problem ;-)