Difficulty fitting a function

Hello. I’m having some difficulties fitting a TGraphErrors to a not very complicated function.

I am using

TF1 *f1 = new TF1("f1","[0] + [1]*cos([2]*x)",40,60);

The graph is not at all complicated and the fit should be easy. However, root is setting parameter [2] to 0.

Am I making an obvious mistake?

we need a small script (+ possible data file) to investigate your problem.


You should also set some reasonable initial parameters. If you don;t set them, they are 0 by default and the fit will not work