How to color a 3D function

Hi, I’d like to ask a question
I wrote down a simple function

TF3 f2 = new TF3(“f2”,"((4x*[0])/(4y[0]+([1]*[1])))-z",xmin,xmax,ymin,ymax,zmin,zmax);
f2->SetParameters(nu,s);

when I go draw it, it is all grey.
Is it possible to color it with a sort of gradient just like this example?

if so, could you please write me down an example of script?
Thank you very much

Have you tried gStyle->SetPalette(1); ?

yes, maybe I type it in the wrong space…
Il show you my script

[code]
void plot(){

TCanvas *c1 = new TCanvas(“schrodingereckhaus”,“schrodingereckhaus”,200,10,1000,1200);
double A, a;

A = 3.0;
a = 2.0;

TF3 *f2 = new TF3(“f2”,"([0]^2/([1]^2 + y^2)exp(-0.5[1]*x^2/([1]^2 + y^2)))-z",-20,20,-20,20,0,2.5);
f2->SetParameters(A,a);

f2->SetTitle("|#varphi(x,t)|^2");
f2->GetXaxis()->SetTitle(“Position x”);
f2->GetYaxis()->SetTitle(“Time t”);

f2->GetXaxis()->SetLabelSize(0.02);
f2->GetXaxis()->SetTitleOffset(1.10);
f2->GetXaxis()->CenterTitle();

f2->GetYaxis()->SetLabelSize(0.02);
f2->GetYaxis()->SetLabelOffset(0.000);
f2->GetYaxis()->CenterTitle();
f2->GetYaxis()->SetTitleOffset(1.10);

f2->GetZaxis()->SetLabelSize(0.02);
f2->GetZaxis()->SetTitleOffset(1.00);

gStyle->SetPalette(1,0);
f2->Draw();
}[/code]

I see you are using a TF3. Such coloring is not available with TF3.
It is with TF2.

[quote=“couet”]I see you are using a TF3. Such coloring is not available with TF3.
It is with TF2.[/quote]

But TF2 only gives me 2D function… Not like the one I showed in picture in my first post…

How can I color a 3D function?

[quote=“batello”][quote=“couet”]
How can I color a 3D function?[/quote][/quote]

Hm, no way!
But function from example … it’s clear how to do a 2d function from this, you have z, not z*z, not sin(z), etc. Is it clear, how to do?

Yes it looks like your funstion is acutally 2D. Do:

TF2 *f2 = new TF2(“f2”,"([0]^2/([1]^2 + y^2)exp(-0.5[1]*x^2/([1]^2 + y^2)))",…