- Notifications
You must be signed in to change notification settings - Fork925
-
I am not sure even how to pose the question so I will post a graphic.. The black dots are data generated from the vendor software and the results will always be the same type of curve. It will rise then at a point will start to decrease. My task is to take any y-value (in this case 43000) and determine where it crosses the curve. the x-values are determined from a curve fit. In this case the x-values corresponding to the two triangles. Looking at the options that Math.Net has I was lookin at maybe using thePolynomial Regression but unsure if this will give me the two x-values for my one y-value. Is there another more appropriate model to use? |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 6 comments 6 replies
-
You mention that the type of the curve is always the same, do you know if the curve has any analytic form? |
BetaWas this translation helpful?Give feedback.
All reactions
-
It does not have an analytic form. Data like this is quite common in my line of work but the internals are all a black box. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Do you know if your function behaves always like eg. a parabola? Can it have multiple local extrema or does it have only a global maximum? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yes it always behaves as per my example with only one hump. In other words it always rises, hits a single max, and then decreases. No data is provided below a certain y-value. In my example there is no data below y=37000. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I would go as far and suggest that you could use a sorting algorithm for your problem. varpoints=newList<(doublex,doubley)>{(0.7,3799.99999999999),(0.724444444444444,4120.10582010581),(0.748888888888889,4360.18518518518),(0.773333333333333,4520.23809523809),(0.797777777777778,4600.26455026454),(0.822222222222222,4600.26455026455),(0.846666666666667,4520.23809523808),(0.871111111111111,4360.18518518516),(0.895555555555556,4120.10582010581),(0.92,3800)};varsortedPoints=points.Select((p,index)=>(p.x,p.y,index)).OrderBy(v=>v.y).ToList();varindexOfMaximum=sortedPoints.Last().index;varminimumValue=sortedPoints.First().y;varmaximumValue=sortedPoints.Last().y;varintersectionLimit=4500.0;if(intersectionLimit<minimumValue||intersectionLimit>maximumValue){// early exit, no intersection}varfirstIndexAfterCrossing=sortedPoints.First(v=>v.y>=intersectionLimit&&v.index<indexOfMaximum).index;if(firstIndexAfterCrossing==0){// you hit the start of the curve}varfirstIndexBeforeCrossing=firstIndexAfterCrossing-1;// then here you do linear interpolation between (firstIndexBeforeCrossing, firstIndexAfterCrossing)// similarly, you can find the crossing in the descending part of your curvevarsecondIndexAfterCrossing=sortedPoints.Last(v=>v.y<=intersectionLimit&&v.index>indexOfMaximum).index; |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks for the tip. That is kind of what I'm doing now. I find the index of the max value and then split the curve into 2 sub curves. The first I use as-is and interpolate. The second I reverse the list and interpolate. I just thought there might have something already built in math.net for this type of problem. Thanks again. |
BetaWas this translation helpful?Give feedback.
All reactions
-
You might also try an iterative parabolic approximation and then use the parabola formula for the intersections. Since the parabola has an easy analytic form, you could come pretty easily towards the solutions. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I searched for parabola in math.net and didn't get any hits. Are you saying roll out my own curve fit? |
BetaWas this translation helpful?Give feedback.
All reactions
-
A parabola is just a second order polynomial, so the foundation is there in Math.NET. What you need to implement would be the iterative part around it. |
BetaWas this translation helpful?Give feedback.
All reactions
-
thats the part that I was hoping was in math.net. :) |
BetaWas this translation helpful?Give feedback.
All reactions
-
@sindizzy is this discussion still active or can we close it? |
BetaWas this translation helpful?Give feedback.
All reactions
-
I was hoping to find a math.net solution. |
BetaWas this translation helpful?Give feedback.
