Error Propagation on a Fit

Hi everyone,
I’m Doing An Experiment to calculate the elastic constant of a spring.
Now I’ve used TGraphErros and fitted data with the formula:
creating a TF1 class function.
I would like to set an error on the value 0.507 that is the mass of the spring, so I Can have the correct error on K.
I’ve Tried to set a fix Parameter but then I can’t give it an error.
I’ve looked for some answer in the forum but I didn’t understand them because I’ve started using root recently and I haven’t a great knowledge of programming language
Is there a “simple way” to do it
Thanks everyone

I guess you could try to fit the “mass of the spring” using T=2.*TMath::Pi()*TMath::Sqrt((x+([m]/3.))/[k]) (setting the initial value your_fit_function->SetParameter("m", 0.0507););

Wile_E_Coyote Thanks for the answer.
I’ve done it but the problem is that root does no get any value of k.
I show you the macro

TGraphErrors *g=new TGraphErrors("$ROOTSYS/macros/Hook1.txt");
g->SetTitle("Metodo Dinamico");
TF1 *f=new TF1("f","2*TMath::Pi()*TMath::Sqrt((x+([M]/3.))/[k])",0.,0.05);

And the result is this

I’ve also tried to give a value k as close as possible to expected but then root changes also the value of M.
What i would like to do is to is to keep M constant, associating it an error, and get the final correct error valutation on k


TF1 *f = new TF1("f", "TMath::TwoPi()*TMath::Sqrt((x+([M]/3.))/[k])", 0., 0.1);
f->SetParameter("M", 0.0507);
f->SetParameter("k", 1.);
g->Fit(f, "WQN"); // "initial pre-fit"
g->Fit(f, ""); // "final fit"

Thanks Wile now the result is this

The problem is I don’t want root to fit the parameter M but only the parameter k

f->FixParameter(f->GetParNumber("M"), 0.0507);

Ok Wile Thanks Very Much Now It works!
Last Question:
Is there a way to associate M an error? because doing like that the error is 0-