I am looking for an algorithm that will take data points and fit a cosine function to them. Anyone know of an algorithm that can fit data to a cosine function in general? The algorithm can be in any language (hence the general) but ultimately I will need it in C. Thanks for your help!