// variaveis globais. podem ser manipuladas // fora das funcoes ou em outras funcoes TGraphErrors *g; TF1 *f; exemplo_fit() { g = new TGraphErrors("fit.dat","%lg %lg %lg"); g->Draw("a p"); g->SetMarkerStyle(20); g->SetMarkerColor(2); g->SetLineColor(2); g->SetTitle("Ressonancia em carga de um RLC"); g->GetXaxis()->SetTitle("#omega [rad/s]"); g->GetYaxis()->SetTitle("V_{C} [V]"); f = new TF1("funcao","[0]/(x*[1]*sqrt([2]^2+(x*[3]-1/(x*[1]))^2))",3000,7000); f->SetParameters(5,1e-6,5,30e-3); f->Draw("same l"); f->SetLineWidth(1); f->SetLineColor(4); }