Curve Fitting Question

Started by
7 comments, last by AntiTwister 7 years, 6 months ago

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.

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.
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.

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.

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.

Yes but I specified that when I said y = ax^2 + bx + c.

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 :)

Yes but I specified that when I said y = ax^2 + bx + c.


Except you didn't. :)
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.

This topic is closed to new replies.

Advertisement