Jump to content
  • Advertisement
Sign in to follow this  
myvraccount

Curve Fitting Question

This topic is 663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a math question.  Suppose I want to fit a parabola to a set of 3 points.  However, I know the exact location of the left-most and right-most point, and only the vertical coordinate of the middle point, but not the horizontal coordinate.

 

But instead, I know that the the vertical coordinate is the global minimum, and so the derivative is 0 at that point.

 

How can I find the equation of that curve?  Please provide a proof.  Thank you.

Share this post


Link to post
Share on other sites
Advertisement
You are trying to find a, b, and c in the equation y=ax^2+bx+c. You can plug your two known points into this equation to get two equations with three unknowns. The third point you need to find is a location on the derivative: 0 = 2ax + b. Solve for x in terms of a and b, and that gives you your third point to plug into the equation: (-b/(2a), min height). Now you have 3 equations and 3 unknowns, which you should be able to substitute and solve.

Share this post


Link to post
Share on other sites
Although AntiTwister's post probably does answer your question, I should point out that a parabola doesn't necessarily have a vertical directrix, so it could be that your problem is underconstrained. If you are really interested in equations like y = a x^2 + b x + c, I suggest you use the term "quadratic function" instead.

Share this post


Link to post
Share on other sites

Um... I don't understand the distinction, Alvaro.  I gave exactly that equation in my post and the parabola will have a global minimum between the two outside points, provided that the middle point is lower than both.

Share this post


Link to post
Share on other sites
The distinction is that a rotated parabola is still a parabola even if it doesn't pass the vertical line test. The set of parabolas described by quadratic functions are the subset of all parabolas in which the axis of symmetry is vertical.

Share this post


Link to post
Share on other sites
You may have intended to specify that equation in your original post, but if you check again I think you will find it doesn't appear there. I assumed it was what you intended and specified it in the beginning of my reply. Doesn't really matter, it was obvious what you meant :)

Share this post


Link to post
Share on other sites
I decided to finish solving this; I don't have a proof per se since I did most of my equation simplification in notepad and lost the intermediate work while I was moving terms around, but I do have something visual that might be better.

https://www.desmos.com/calculator/hpcca2u3cc

(q0, p0) is the first known point, (q1, p1) is the second known point, and p2 is the y coordinate of the third known point at the bottom of the parabola. You can slide these values around to see how it affects the shape of the parabolas and where the solution becomes degenerate.

I found that this problem gets a lot easier if you make everything relative to the first point before solving it. Notice that the parabola you probably want (which has the point at the minimum height in between the other two points) switches when q0 is made greater than q1.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!