# TF1 Draw does not plot correct cosine function

**URL:** <https://root-forum.cern.ch/t/tf1-draw-does-not-plot-correct-cosine-function/36898>\
**Category:** Newbie\
**Created:** [November 19, 2019, 10:39pm UTC](https://root-forum.cern.ch/t/tf1-draw-does-not-plot-correct-cosine-function/36898 "2019-11-19T22:39:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nyx](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@Nyx](https://root-forum.cern.ch/u/Nyx)\
**Post date:** [November 19, 2019, 10:39pm UTC](https://root-forum.cern.ch/t/tf1-draw-does-not-plot-correct-cosine-function/36898/1 "2019-11-19T22:39:40Z")

</div>

I am trying to fit data points with a cosine function, with decaying amplitude. If I fit and plot short range, this looks fine:

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/c/6/c60d3a9b3e6bd71cae8b8d5d2f77e0e6cfb19623.png)

However, if I increase the time range I get this:

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/7/6/764ecc46fdccee99c59d5104f4daf375d117f1bf.png)

Here the fit function (red) does not look like a cosine function at all. How is that possible?

---

<div class="post-metadata">

**Author:** ![Nyx](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@Nyx](https://root-forum.cern.ch/u/Nyx)\
**Post date:** [November 19, 2019, 11:49pm UTC](https://root-forum.cern.ch/t/tf1-draw-does-not-plot-correct-cosine-function/36898/2 "2019-11-19T23:49:42Z")

</div>

I think I fixed this myself with the function SetNpx().
