Sine regression phase shift with known amplitude and period from data points

849 Views Asked by At

I have a rotating data set of 72 points per revolution and I am trying to find the high or low point on the rotation. I know my period will always be 2pi/72 and I can get a pretty decent amplitude and vertical offset from my data set. The data set is not always good enough for me to just grab the highest or lowest values and make decisions based on that. I am using $$y=A\sin(Bx+C)+D $$ y=Asin(Bx+C)+D as my base equation. given that I have some reasonable x,y values and I can get A,B,and D from my data set, I would think that I could average calculating some values of C with multiple data points and get close enough(I would like to be within +-5 degrees). I have $$C=\sin^{-1}(\frac{y-D}{A})-Bx$$ this does not seem to work with ARCSIN as either radians or degrees. Attached is a graph of the data with a sine overlay I arrived at by guessing for C. What am I missing here? Data and formula graph Thanks for reading! if my Mathjax is incorrect, please let me know.

2

There are 2 best solutions below

1
On BEST ANSWER

Since you know the value of $B$, expand the sine and write $$y=A\sin(Bx+C)+D=A \sin (C) \cos (B x)+A \cos (C) \sin (B x)+D$$

Now, let $\alpha=A \sin (C) $, $\beta=A \cos (C)$, $u=\cos (B x) $, $v=\sin (B x)$ which make $$y=\alpha u+\beta v+D$$ which is a simple linear regression.

When done, $\alpha^2+\beta^2=A^2$ and $\frac \alpha \beta=\tan( C)$

0
On

Well, I have a decent solution for what I am trying to do. Instead of trying for a sine of best fit. I am taking the average of all the data points, then finding the data points above and below(about 8 data points total). Since a sine is pretty close to a line where it crosses the vertical offset I then do a least squares linear regression. then I solve for Y where x = average(vertical offset). then I know my high and my low are 18 data points +- from where that point is(1/4 the period). Given my data seems to be least reliable at the high and low of my curve this seems a much better solution than only using the highest and lowest values.

https://www.desmos.com/calculator/oeklhdh1oh