I am having trouble in creating my own fitting function in python. In particular my problem is the following. I have the following set of data:
vel = [-337, -108, 79, 309, 518, 528, 494, 432, 203, 15, -236, -401, -496]
phase = [-0.1405, -0.0583, 0.0325, 0.0998, 0.174, 0.231, 0.3079, 0.3699, 0.4388, 0.5008, 0.5698, 0.6371, 0.7276]
err = [45.342891308377489, 73.067581785521284, 41.676025292022672, 68.304971952287929, 92.089464137519201, 45.111554097374324, 38.922906106705625, 35.431519418447465, 42.787787783231522, 19.305857846218228, 59.22902735428562, 49.416599841251582, 63.027937055619532]
Where the first array is the y value, the second is the x and the third one contains the error of the y value. I should now create a function of the form
V(\phi) = \gamma + K1*sin(2*pi*\phi) +K2*cos(2*pi*\phi)
to fit the data. The values of the parameters have to be obtained from the best fit.
Any idea on how to do that?