# How set more then 11 parameters for a fit function?

**URL:** <https://root-forum.cern.ch/t/how-set-more-then-11-parameters-for-a-fit-function/55341>\
**Category:** ROOT\
**Tags:** roofit\
**Created:** [June 17, 2023, 9:31pm UTC](https://root-forum.cern.ch/t/how-set-more-then-11-parameters-for-a-fit-function/55341 "2023-06-17T21:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divyang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/7ea924/32.png) [@Divyang](https://root-forum.cern.ch/u/Divyang)\
**Post date:** [June 17, 2023, 9:31pm UTC](https://root-forum.cern.ch/t/how-set-more-then-11-parameters-for-a-fit-function/55341/1 "2023-06-17T21:31:38Z")

</div>

Hello everyone,

I am trying to fit a curve on the histogram which has more than 11 parameters. However, I noticed that the `SetParameters()` allows only 11 entries. So, my code is giving an error.

I just want to fit the histogram and in output chi2 minimized parameters. Any suggestion would be a great help. Following is the snippet of the code.

```auto
  TF1 *fit2 = new TF1("fit2", my_func, 1, 6., 12);
  fit2->SetParameters(4.96478e+00,
                      2.31372e-01,
                      2.13283e+02,
                      4.71709e-01,
                      5.16176e+00,
                      8.75612e-02,
                      1.22796e+04,
                      1.25758e+00,
                      4.24852e+00,
                      1.34468e-01,
                      1.36518e+02,
                      1.);
  fit2->SetLineColor(kRed);
  fit2->SetLineWidth(4);
  h2->Fit(fit2, "R+");

```

---

<div class="post-metadata">

**Author:** ![smgrig](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/smgrig/32/19464_2.png) [@smgrig](https://root-forum.cern.ch/u/smgrig)\
**Post date:** [June 18, 2023, 12:00am UTC](https://root-forum.cern.ch/t/how-set-more-then-11-parameters-for-a-fit-function/55341/2 "2023-06-18T00:00:35Z")

</div>

Hi,

```auto
double pars[12]={1,2,3,4,5,6,7,8,9,10,11,12};
fit2->SetParameters(pars);

```

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 2, 2023, 12:01am UTC](https://root-forum.cern.ch/t/how-set-more-then-11-parameters-for-a-fit-function/55341/3 "2023-07-02T00:01:05Z")

</div>

Closed on July 2, 2023, 12:01am UTC

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