Now modify the program so that while generating the data it uses some method, of your choice, to produce a good estimate of the period from the data. The estimate must be based only on the y values, and could for example use a sliding window.
#define PI (4*atan(1))
double A, t, T, p, n, w, y, a, b, c;
for(t=0; t<=50; t++)
y=A*sin( w*t + p) + n;
printf("%f %f \n\n", t, y);
Then, at the end, generate separate sine data using your sine function with w based on the estimated period, the original values of A and p, and no noise, to plot over the same range of t with points and lines.
It orginally plots just points, now i need to plot a line in addition (along the points as much as possible).Thanks in advance and please keep it real simple if possible.