0

I have a few pairs of points (x,y) and I would like to get parameters of the fitted function. I need these parameters because I would like to count the number of local extremes of the function. Is there any library for C# that can do it?

Example of the trendline from excel:

Excel chart

krawat10
  • 181
  • 1
  • 10
  • You may look over [this post](https://stackoverflow.com/questions/51261839/generate-a-trendline-from-files-in-a-chart/51263752#51263752) which both shows how to something along the lines of calculating and displaying data yourself and [here](https://msdn.microsoft.com/en-us/library/dd456699.aspx) where various built-in functions can be found. Not sure if your problems are solved there, though.. – TaW Oct 02 '18 at 18:20
  • A root finding algorithm of some kind will do it if you can get a description of the curve. – duffymo Oct 02 '18 at 18:49
  • 1
    OP, bear in mind the results you get for the local minima are influenced first and foremost by the assumptions you make about the form of the function to model the data. Given a function, you can find local minima by various means. By far the most interesting and important question is, what function are you assuming. Hope this helps. – Robert Dodier Oct 02 '18 at 19:01
  • At first, I thought about fitting sin function, because I need only the number of local minima (It would be solved by the number of periods). However, this function may have irregular periods and intervals where the function values are almost constant (dx / by ~ 0). On the other side, I cannot assume any polynomial because I don't know a degree. – krawat10 Oct 02 '18 at 19:59
  • A piecewise polynomial fit is your best bet. You won't have one function; you'll have several, each within a range of your data. – duffymo Oct 02 '18 at 20:19

0 Answers0