# Fluctuation in the fitting function

**URL:** <https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638>\
**Category:** Newbie\
**Created:** [February 21, 2021, 5:27am UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638 "2021-02-21T05:27:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prabhu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/prabhu/32/38025_2.png) [@Prabhu](https://root-forum.cern.ch/u/Prabhu)\
**Post date:** [February 21, 2021, 5:27am UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638/1 "2021-02-21T05:27:25Z")

</div>

Hi,  
Recently, when I was fitting the data with a function, I found something strange to me. Just after fitting the histogram when I draw, it shows some small fluctuation(noise) in the fitting function. But when I save the histogram in a root file after fitting and plot it later the noise was gone and the fitting function was smooth. I am attaching the two plots below. So what can be the reason behind this?  
Thank you!

 ![fig1](https://root-forum.cern.ch/uploads/default/original/3X/7/a/7a71117375684bc3921aae192588f0fa02bddc3b.gif)  
 ![fig2](https://root-forum.cern.ch/uploads/default/original/3X/4/2/423fc0d9de64de61a4b5011afdb1aff961fd1f3e.gif)  
_ROOT Version:_ 6.16  
_Platform:_ Mac OS  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 21, 2021, 9:19am UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638/2 "2021-02-21T09:19:42Z")

</div>

These are two different data sets.

---

<div class="post-metadata">

**Author:** ![Prabhu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/prabhu/32/38025_2.png) [@Prabhu](https://root-forum.cern.ch/u/Prabhu)\
**Post date:** [February 21, 2021, 2:34pm UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638/3 "2021-02-21T14:34:09Z")

</div>

Hi, Wile\_E\_Coyote,  
No these are the same data points. The histograms are the same too. I have just zoomed the axis of the first plot a little bit.

Thank you.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 21, 2021, 2:40pm UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638/4 "2021-02-21T14:40:11Z")

</div>

Compare the “y” values at around “x=1”.

---

<div class="post-metadata">

**Author:** ![Prabhu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/prabhu/32/38025_2.png) [@Prabhu](https://root-forum.cern.ch/u/Prabhu)\
**Post date:** [February 21, 2021, 3:11pm UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638/5 "2021-02-21T15:11:42Z")

</div>

Hi Wile\_E\_Coyote,  
I am attaching the two figures again.

 ![fig1](https://root-forum.cern.ch/uploads/default/original/3X/9/8/9873ccd6e80f75e84e220614ac62582c4da482e3.gif)  
 ![fig2](https://root-forum.cern.ch/uploads/default/original/3X/0/d/0de353abde688a0995ec456f3272dd1e9e1d0744.gif)  
Now you can see the fluctuation in the function mostly in the lower region of x in Fig-1.

Thank you

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 21, 2021, 3:45pm UTC](https://root-forum.cern.ch/t/fluctuation-in-the-fitting-function/43638/6 "2021-02-21T15:45:11Z")

</div>

Can you try, right after you create the “fit function”: `fit_function->SetNpx(500);`
