How to find A and k constants of the equation $y_n = A cos(x_n + k)$ when $y_1 ... y_n$ and $x_1 ... x_n$ is available in a iterative process. Data is received iteratively. All data is not available at once.
In other terms, I want to fit the data to a cosine where I have some data for a segment of the curve but don't have data at 0 degrees or 90 degrees so cannot using zero crossing.
Thank you.
Use linear approximation to fit $$ y_n=a\cos(x_n)-b\sin(x_n) $$ Then $(A,k)$ are the polar coordinates of the point $(a,b)$.
Use an incremental scheme for linear regression.