For an assignment I have to write code to fit each ten samples in my data using a loop. On each iteration of the loop, I have to reset p to some fixed values and prevent the amplitude parameter from becoming negative, and include this transformation when I calculate the average amplitude.
How do I do this and also calculate the phase offest, RMS error and the mean amplitude? I have no idea where to start!