PHP Sinusoidal Regression

I have a one-dimensional dataset in PHP, to be precise, an array with linearly increasing indices (to represent values ​​on the x axis, with the delta equal to 1) and corresponding values ​​(representing values ​​on the y-axis). My question is: how can I do a sinusoidal regression for such a dataset? I found linear, exponential and even logarithmic regression algorithms, but there isn’t for a sinusoidal curve.

The dataset is formatted as such:

f (x) will be equal $array[$x], where x ∈ ℕ

+3
source share
1 answer

Here, the Python implementation of a similar algorithm that I came across the other day may be useful; it should not be too difficult to translate into PHP:

http://exnumerus.blogspot.co.uk/2010/04/how-to-fit-sine-wave-example-in-python.html

0
source

All Articles