Plot of a Gaussian 2d

Hello!
I’m trying to draw a gaussian 2d but the plot is flat. How can I do?
Here’s my code:
#include
#include

#include “TGraph.h”

Double_t myfunction(Double_t x, Double_t par)
{
Float_t xx =x[0];
Float_t yy = x[1];
Double_t f = par[2]
((exp(-0.5
((xx-par[0])/par[1])((xx-par[0])/par[1])))exp(-0.5((yy-par[3])/par[1])((yy-par[3])/par[1])));
return f;
}
TF2 *fa = new TF2(“fa”,myfunction,-15,15,-10,10,4);
void Myfunc_random() {
TCanvas *can = new TCanvas();
fa->Draw(“surf”);

}

TF1::SetParameters

But I have a TF2 function. When I try to use SetParameter the terminal says “cannot use arrow operator on a type”.
Thank you for the fast answer

Try “fa->SetParameters(0., 1., 1., 0.);” right before “Draw”.

Perfect! It works well now.
Thank you so much

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.