Hello,
I want to plot the exponential function for +ve and -ve value of [0] on the same graph. How can I do this without defining another new function?
TF1 *f0 = new TF1(“f0”, “exp(-[0]*x)”, -4,4);
f0->SetParameter(0,0.5);
f0->Draw();
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
I’m not sure what you really want …
… maybe this …
Double_t ve = 4.; f0->SetRange(-ve, ve); f0->Draw();
… or maybe this …
Double_t ve = 4.;
f0->SetParameter(0, ve); f0->DrawCopy("L");
Int_t n = 10;
for (Int_t i = -n; i < n; i++)
{ f0->SetParameter(0, i * (ve / n)); f0->DrawCopy("L SAME"); }
gPad->SetLogy(1);
… or maybe that …
Double_t x = 4., y = 4.;
TF2 *f = new TF2("f", "exp(-x*y)", -x, x, -y, y);
f->Draw("surf2 z");
gPad->SetLogz(1);
If I have function like exp(-kx). I want to plot for +ve and -ve value of k in the rang (-4,4).
If I apply above code, it just update the latest value of the SetParameter. I only get onside of the curve (either +ve k or -ve k).
Hope I made the question clear.
I mean I wanted to update the plot with new SetParameter for the already defined function. Is it possible to do that? In my code, I got the plot with the most recent value of SetParameter ( only one plot, expected plot is two curve).
Maybe:
Double_t ve = 4.;
f0->SetParameter(0, -ve); f0->DrawCopy("L");
f0->SetParameter(0, ve); f0->DrawCopy("L SAME");