{
Double_t myFunc(Double_t *x, Double_t *p) {
return sin(*x)*cos(*x*1.1);
}
TF1 *f = new TF1( "myF", myFunc, -20, 20);
TCanvas *cv = new TCanvas("cname" , "canvas title", 800, 600);
cv->cd();
myF->SetNpx(10000);
myF->SetLineColor(4);
myF->SetLineWidth(3);
gPad->SetFillColor(kYellow-10);
gPad->SetGrid();
myF->Draw();
myF->SetTitle("plot title;x-axis title;y-axis title");
}
{
R = new TRandom( time(NULL) );
for ( int i=0; i<15; i++ )
cout << R->Gaus( 24.5, 2.3 ) << endl;
}
{
Double_t myFunc(Double_t *x, Double_t *p) {
return sin(x[0])*cos(x[0]*p[0]);
}
TCanvas *cv = new TCanvas("cname" , "canvas title", 800, 600);
cv->cd();
R = new TRandom( time(NULL) );
TF1 *f = new TF1( "myF", myFunc, -20, 20, 1);
myF->SetTitle("overlapped plots;x-axis title;y-axis title");
myF->SetNpx(10000);
myF->SetLineWidth(1);
myF->SetLineColor(4);
gPad->SetFillColor(kYellow-10);
gPad->SetGrid();
string opt="";
for ( int i=0; i<20; i++ ) {
myF->SetParameter(0,R->Gaus( 1.0, 0.01 ));
myF->DrawClone( opt.c_str() );
opt="same";
}
}