How to add two defined function

Dear experts,

I want to add two defined function and follow the examples:
TF1 *fcos = new TF1 (“fcos”, “[0]*cos(x)”, 0., 10.);
fcos->SetParNames( “cos”);
fcos->SetParameter( 0, 1.1);

  TF1 *fsin = new TF1 ("fsin", "[0]*sin(x)", 0., 10.);
  fsin->SetParNames( "sin");
  fsin->SetParameter( 0, 2.1);

  TF1 *fsincos = new TF1 ("fsc", "fcos+fsin");

The attachment is my script, however, the error shows “unknown f3”.
Could you help me with my script?

Best regard,
Jiechen

posrebs2.C (933 Bytes)

posrebs2.C (1.3 KB)

Dear experts,

Thanks very much for your help, it works smoothly after you revised.
Have a nice day.

Best regards,
Jiechen

1 Like

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