Fitting quadratic curve to three constraints

Bob Smith
Messages
16
Reaction score
0
This should be easy but I've not done this in years and I'm feeling dense:

I need to fit a quadratic curve to three constraints, two of which are points, the third is an angle.

I've found examples to do this but only if all three constraints are points, so if someone would kindly explain the process I'd be a happy man. :)

Edit: I should add I've got an old example in front of me where I did just this (for a cubic equation though) but due to poor notes on my part I can't quite understand what I was doing.
 
Last edited:
Mathematics news on Phys.org
Can you post the old example, however poorly annotated?
 
I assume the two points you are given are points on the parabola but what is the angle?
 
One method is to treat it as a differential equation problem. All parabolas are solutions of

\frac{d^2y}{dx^2} = 2A

for some constant A. Integrating, you get

y = Ax^2 + Bx + C

Now, you have three parameters, and three conditions. Translate your angle into a slope, and you can write your conditions as

y(x_1) = y_1

y(x_2) = y_2

\left \frac{dy}{dx} \right|_{x_3} = \tan \theta

then just solve for A, B, and C.
 
I should have been a bit more specific in my post.

I can form the two equations and the derivative equation for the constraints. The angle is also at the same point as one of the points the curve must fit, and sine the angle is zero (top of the curve), it is the same as the gradient, so no need to worry about converting.

The bit I got stuck as was what to do with the equations, i.e. how to solve. :) Like I said, it's been a long time since I touched this. I'll have a bit more of a play and see if I can get it to work.

Edit: I should add, once I've got this working, I'll want to add a fourth constraint that is the gradient of the other point (which will be non-zero), so need a general solution that I can scale up to a cubic equation. Thinking about it, perhaps if I try that from the beginning, it will make my old example easier to work from.

Edit again: nope, still no luck. If it weren't for the gradients this am I correct in thinking this is a simultaneous equations problem (which I can do), but as is, it involves differential equations (which I can't). So I probably made the thread in the wrong section too.
 
Last edited:
Well, thought I should add I got my solution by using matrices for the simultaneous differential equations. Cheers anyway. :)
 
hmm...finding the constants A, B, and C is just a matter of solving simultaneous linear equations...but I suppose that's what you did if you used matrices.

If you want a curve that conforms to four constraints in order to match a given angle at both endpoints, then you should look up "cubic spline".
 
Back
Top