Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Curve interpolation with multiple results#1048

Unanswered
sindizzy asked this question inQ&A
Discussion options

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?

image

You must be logged in to vote

Replies: 6 comments 6 replies

Comment options

You mention that the type of the curve is always the same, do you know if the curve has any analytic form?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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;
You must be logged in to vote
5 replies
@sindizzy
Comment options

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.

@jkalias
Comment options

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.

@sindizzy
Comment options

I searched for parabola in math.net and didn't get any hits. Are you saying roll out my own curve fit?

@jkalias
Comment options

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.

@sindizzy
Comment options

thats the part that I was hoping was in math.net. :)

Comment options

@sindizzy is this discussion still active or can we close it?

You must be logged in to vote
1 reply
@sindizzy
Comment options

I was hoping to find a math.net solution.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@sindizzy@jkalias

[8]ページ先頭

©2009-2025 Movatter.jp