Identify which of the three signals is closest to a sinusoidal curve I have some acceleration values from a sensor. These values are reported as x, y and z components of the acceleration. As can be seen in the attached figure, it is clear that the z signal has a clear sinusoidal curve present. Is there any algorithm to quantify the &quot;sinusoidalness&quot; of a curve. I am trying to write an algorithm that would identify the z signal of the attached image to be the most sinusoidal.

Another example is shown in the figure below: For this image the x-axis contains the &lt; most sinusoidal &gt; signal and the algorithm must be able to identify the x-axis as the correct axis.

Edit: The variation could indeed be greater in any of the axes without the most sinusoidal signal. The original problem being solved here is to count the number of breaths in the accelerometer signal. To do this first the axis containing the breathing signal must be identified. From the image it is obvious that for the first image the z-axis has the breathing data and for the second image the x-axis has the breathing data
Is it sufficient to identify the «most sinuoidal» of those 3, or would you also want linear projections of those (consistent with a IMU sensor tilted vs the plane of motion)?
A simple solution might be to do a windowed fft and pick the direction where the «crest factor» of the fft magnitude was largest (best explained by a single sinoid).
Edit:
It appears thah your «sine» is somewhat variable. If the above approach fails, then perhaps removing the DC component («highpass filter») followed by removing the high frequency edges and impulses (lowpass filter) for an effective tuned bandpass filter, followed by squaring and summing the samples could be used.