Defining a simple function

Hello!

I wish to define a function (a straight line y=k*x+m to begin with) where I need to define k and m outside the definition of the function, eg:

k=1;
m=1;
TF1 fun1 = new TF1(“fun1”,"kx+m",0,20);

Do I need to define a function (Double_t MyFunction() ) to do this?

Grateful for help!
Karin

Hi Karin
Just do:

```TF1 *fun1 = new TF1("fun1","[0]*x+[1]",0,20); ```and then set your two parameters with

``` fun1->SetParameters(k,m); ```where k and m are the actual values of your parameters.
We have several examples in the tutorials.

Rene

perfect, thank you!