How to confirm if all points lie on sine wave.

104 Views Asked by At

Given at least 3 points $(x_{i}, y_{i})$, how to confirm if all points lie on a sine wave? Or alternatively, how to determine the parameters of a sine wave that best fits the data (I'm guessing amplitude and phase would be sufficient?).

Context: I am processing images and attempting to identify sinusoidal features within a rock face programmatically. I'm able to identify these as well as other features using edge detection. I'm now trying to isolate the sinusoidal features. I have a number of ideas of how to do this, the above idea would likely be the least computationally intensive but I've no idea hoe to go about it.

2

There are 2 best solutions below

4
On

The $3$ points if be ...

  1. (a, b)
  2. (c, d)
  3. (e, f)
    then ...
    $\sin a = b$ and $\sin c = d$ and $\sin e = f$ then the $3$ points are on a sine curve.

However, I haven't come across anyone/anything that clearly states the minimum number of points for a sine wave. For instance if you know a relationship is linear (a straight line), you need only find $2$ points. From what I know, a sine wave has to be periodic/cyclical and has to have a maximum and a minimum and a midline, the max & min equidistant from the midline.

1
On

Three points given

Here is a program for three points given on line3 solved by least squares method. Output signal tallies exactly with (goes through) the 3 given points.

Recently I was helped for this by Bill on Mathematica site.

enter image description here

EDIT !:

Another signal containing 3 input points with exact match:

$$(x1, y1, x2, y2, x3, y3)=(1., 0.4, 3., 1., 12., -2.); $$ $$(a,b,c)= (2.1450555574383996,-1.9070717143143807,2.094645060163228); $$ enter image description here

More than three points given

Note that if we give more than 3 points, a least square fit would be obtained in terms of the three coefficients using the same code.