[RESOLVED] Equation of curve through three points.

Can someone help me here?
I need the equation of a curve that passes through three known points. At two points the tangential angle of curve is 0. The third known point is the point of contraflexure. Is there a cubic equation that is simple to determine from these coordinates?

Can someone help me here?
I need the equation of a curve that passes through three known points. At two points the tangential angle of curve is 0. The third known point is the point of contraflexure. Is there a cubic equation that is simple to determine from these coordinates?

Don't think you can do it with a single cubic polynomial. Since you have 3 fixed points plus 2 derivatives, that's 5 constraints - for that you need a 4th order polynomial (or perhaps 2 cubic splines that are joined).

Since you used the word contraflexure, does that mean this is a beam bending situation? If so, then I'd think you could use beam equations, which are 4th order. Another possibility might be a single cubic Bezier, though I'm not sure it would match the requirements exactly.

Since you used the word contraflexure, does that mean this is a beam bending situation?

A slab actually. If your familiar with engineering I'll see if i can explain this a bit better.

I'm looking to find the levels of a post tensioned cables running through a slab. The point of contraflexure is actually the point at which the tendon changes curvature.

Been out of uni for about 7 years so lost a bit of what I may have learnt. A Cubic Bezier definately doesn't ring a bell though. Was hoping that it might be simple.

Been out of uni for about 7 years so lost a bit of what I may have learnt.

Heck, it's been >>20 years in my case! I had basic solid mechanics, but not much specific to Civil.

A pair of joined cubic splines isn't really very difficult to construct. It just means solving a set of linear equations - easy to do with Excel matrix functions.

A 4th order polynomial would be even easier (or about the same). Is there some reason you don't want to use a 4th order poly?

Last edited by VBAhack; Apr 18th, 2007 at 03:03 PM.

With all the computer programs these days my job is sadly almost becoming data entry. Don't often have too much of a need to even construct 4th order polynomial equations. Tendon profiles are often installed with a relatively significant tolerance and I can't imagine there'd be a vast difference to a 4th order polynomial or a "Cubic Benzier" curve. Any tips on constucting a 4th order polynomial equation with the coords and angles above?

Actually, this problem is a perfect situation for 2 joined cubic splines - 3 points with known end conditions (i.e. zero derivative):

We have 2 cubic splines

y = ax^{3} + bx^{2} + cx + d ....for x =< 7
y' = 3ax^{2} + 2bx + c
y'' = 6ax + 2b

y = ex^{3} + fx^{2} + gx + h ....for x > 7
y' = 3ex^{2} + 2fx + g
y'' = 6ex + 2f

There will be a total of 8 equations with 8 unknowns:

1: 0 = 3ax_{1}^{2} + 2bx_{1} + c
2: y_{1} = ax_{1}^{3} + bx_{1}^{2} + cx_{1} + d
3: y_{2} = ax_{2}^{3} + bx_{2}^{2} + cx_{2} + d
4: 0 = 3ax_{2}^{2} + 2bx_{2} + c - 3ex_{2}^{2} - 2fx_{2} - g
5: 0 = 6ax_{2} + 2b - 6ex_{2} - 2f
6: y_{2} = ex_{2}^{3} + fx_{2}^{2} + gx_{2} + h
7: y_{3} = ex_{3}^{3} + fx_{3}^{2} + gx_{3} + h
8: 0 = 3ex_{3}^{2} + 2fx_{3} + g

Equations (1) and (8) are the end conditions with zero slope. Equations (2) and (3) are points P1 and P2 using the 1st cubic spline. Equations (6) and (7) are points P2 and P3 using the 2nd cubic spline. Equation (4) matches the slope (1st derivative) of the 2 splines at P2. And, equation (5) matches the curvature (2nd derivative) of the 2 splines at P2.

This all rings a big bell. I did statistics as a minor in a seperate degree and also created a vb project for my final year engineering project that did exactly this. Just not 4th order polynomials. And I've forgotten it all. I had to generate concrete mix designs from huge amounts of test data, curve fitting which required matrix calculations from the test data.

For some reason I thought that it'd be a little easier. Thankyou. Your help is not falling on someone who doesn't understand.

Task now is to code it up. Hoping the old project is on my computer back in Aus.

Re: [RESOLVED] Equation of curve through three points.

VBAhack,

This is embarasing. I knew how to do this in university but it seems to have slipped my mind.

As far as I remembered I highlighted the range of cells that my inverse matrix would be outputted to and entered say =MINVERSE($B$6:$F$10) into the first cell then pressed CTRL+ENTER and the MINVERSE matrix would be generated.

Is it something to do with the $ signs that I'm using?

Haven't had any luck coding this thing yet but I've tried.

Re: [RESOLVED] Equation of curve through three points.

Hey sgrya1,

Something doesn't seem right about this - in particular the point of contraflecture. If contraflecture. means the location where the curvature is zero, which I think it does, then due to symmetry, the point of contraflecture should be midway between the end points, unless there is an imposed curvature at either end.

Just for kicks, I fit a cubic polynomial to the end points, enforcing zero slope, and completely igorning the 2nd point. The result, of course, was zero curvature at the midway point. Oddly enough, the value I read from your graph for the point of contraflecture. (7,6) pretty much matches a point on the curve if the coordinates are reversed. Check out the attached spreadsheet.

Last edited by VBAhack; May 2nd, 2007 at 10:30 AM.

Re: [RESOLVED] Equation of curve through three points.

Originally Posted by sgrya1

Is there a way I could enforce the point of zero curvature to a specified point (so that it is not necessarily at the midpoint)?

Yes, but you'd need a single 4th order polynomial or two 3rd order polynomials that are joined, but only if all you are specifying is the x location of the interior point that has zero curvature. If you also want to specify the y value, then you'd need a 5th order poly or two 4th order polys that are joined.

Originally Posted by sgrya1

How would I create say a 2nd order polynomial curve with just two defined points. The first has a gradient of 0 and the second has 0 curvature.

Can't do it with 2nd order polynomials - the curvature is constant - just differentiate twice and you'll see. For these kinds of problems, you can pretty much forget about 2nd order polynomials - they just don't work very well.

The best approach to answering these kinds of questions is to use the concept of # equations = # unkowns.

For example, consider a 4th order polynomial. It has 5 unknowns, thus 5 equations (can also call them constraints) are needed. In the case of your first question about specifying the location of zero curvature, here is the logic. You have 2 endpoints - that's 2 constraints/equations. You have zero slope at those 2 endpoints - 2 more, for a total of 4. That leaves one additional condition that can be specified. It can be the y-value at a particular x-value, or the slope at a particular x-value, or the curvature at a particular x-value, etc. If you choose the x location where the curvature is zero, you can't also specify the y value or the slope - that would be too many constraints - a higher order poly would be needed.

Similarly, with 2 joined 3rd order polys, you need 8 equations. Here is the logic. You have 2 endpoints and 2 slopes, that 4 equations. You have an interior point (i.e. x location) that is common to both polys - 5th equation. You want the slopes of both polys to match at the common point - 6th equation. You want the curvature of both polys to match at the common point - 7th equation. Finally, you want the curvature at a specified x value to be zero - 8th equation. By the way, the point where the polys join doesn't necessarily have to be the same point where the curvature is zero - it can be but doesn't have to.

Attached is a plot showing 5 different sets of joined cubic polynomials - each set has the same 2 endpoints with zero slope but a different choice for the x location of zero curvature. The dots represent the chosen x locations of zero curvature. By the way, plots of 4th order polys w/ varying x locations of zero curvature will look similar.

Hope this helps.
.

Last edited by VBAhack; May 28th, 2007 at 12:25 AM.

Re: [RESOLVED] Equation of curve through three points.

I can’t thank you enough for this. Feel like a dumb kid in year 9.
I’ve tried generating the forth order polynomials but I’m getting some odd results. All the constraints are met but it’s not what I’m after. Is there another restraint (or restraints) that I can add? Your cubic solution chart in your last post is what I expect but I can’t replicate it even though your instructions are as clear as day. Ideally I stick with the 4th order polynomial as it’s simpler.

Do you still have the spreadsheet you used to generate those curves? The first 4 equations are obviously simple enough to get but I’m struggling to work out what equations 5 – 8 are given that each one needs to satisfy two equations .
y = ax3 + bx2 + cx + d Cubic Eqn 1
y' = 3ax2 + 2bx + c Slope
y'' = 6ax + 2b Curvature
y = ex3 + fx2 + gx + h Cubic Eqn 2
y' = 3ex2 + 2fx + g Slope
y'' = 6ex + 2f Curvature

Eqn 1 y1 = a*x13 + b*x14 + c*x1 + d End Point 1
Eqn 2 y2 = e*x23 + f*x24 + g*x2 + h End Point 2
Eqn 3 y'(x1) = 0 = 3*a*x12 + 2*b*x1 + c Slope at End Point 1
Eqn 4 y'(x2) = 0 = 3*e*x22 + 2*f*x2 + g Slope at End Point 2

Re: [RESOLVED] Equation of curve through three points.

4th order poly results look right - the further you depart from the midpoint as the location of zero curvature, the wilder the curve - I got the same result.

Joining two cubic polys and forcing the join point to have zero curvature I believe will give you the result you are seeking. It is much better behaved. Per my previous post, even though the point of zero curvature doesn't have to be the join point, if they differ you'll get results that are similar to the 4th order poly.

In joining two cubic polys, the remaining 4 equations have to do with ensuring continuity of point, slope, and curvature at the join point, and forcing zero curvature where you want it. Assumming the point of zero curvature and the join point are the same (i.e. x_{3}):

Eqn 1: y_{1} = a*x_{1}^{3} + b*x_{1}^{2} + c*x_{1} + d .......... End Point 1 (yours has typo - 2nd term should be power 2, not 4)
Eqn 2: y_{2} = e*x_{2}^{3} + f*x_{2}^{2} + g*x_{2} + h .......... End Point 2 (same comment)
Eqn 3: y'(x_{1}) = 0 = 3*a*x_{1}^{2} + 2*b*x_{1} + c .......... Slope at End Point 1
Eqn 4: y'(x_{2}) = 0 = 3*e*x_{2}^{2} + 2*f*x_{2} + g .......... Slope at End Point 2
Eqn 5: 0 = a*x_{3}^{3}+ b*x_{3}^{2} + c*x_{3} + d - e*x_{3}^{3} - f*x_{3}^{2} - g*x_{3} - h ..... join point is common to both polys
Eqn 6: 0 = 3*a*x_{3}^{2} + 2*b*x_{3} + c - 3*e*x_{3}^{2} - 2*f*x_{3} - g ............... slope continuity at join point
Eqn 7: 0 = 6*a*x_{3}+ 2*b - 6*e*x_{3} - 2*f .................... curvature continuity at join point
Eqn 8: y''(x_{3}) = 0 = 6*e*x_{3} + 2*f ......................... zero curvature at interior point

Equation 5 just says that y_{3} in the 1st poly = y_{3} in the 2nd poly. Equation 6 is the same only slope. Equation 7 is the same only curvature. Equation 7 could have alternatively been written as: 0 = 6*a*x_{3} + 2*b. The result will be the same. The way I did it is more general in that it's easier to have the point of zero curvature be a different point than the join point - equation 8 would just be 0 = 6*e*x_{4} + 2*f or 0 = 6*a*x_{4} + 2*b depending on where x_{4} is.

I suggest you play around with having the join point and point of zero curvature differ - just to see how the result changes.

Have fun
.

Last edited by VBAhack; May 28th, 2007 at 06:21 PM.

Re: [RESOLVED] Equation of curve through three points.

I loved math through university. It was a game as I understood it well. I must be getting older and am understanding how some people got frustrated.

Why can't I get the same results? I've checked all the formulas and they all seem logical. I've also checked and rechecked the matrices a number of times.

Attached is what I've put together but one curve is not complying with the constraints. Can you post your excel sheet so I can cross check them?

BTW, how do you add a single point to the curve in excel?

Last edited by sgrya1; Nov 27th, 2011 at 10:12 AM.

Re: [RESOLVED] Equation of curve through three points.

Another question, I've found a textbook that says that I should join two 2nd order polynomials for the tendon profile. Not sure of the science behind which (2nd order or 3rd order) would be more suitable for post tensioned concrete design but I need a square matrix to invert.

y = ax2 + bx + c Cubic Eqn 1
y' =2ax + b Slope
y'' =2a Curvature
y = dx2 + ex + f Cubic Eqn 2
y' = 2dx + e Slope
y'' = 2d Curvature

Yields 6 unknowns but I still see that there should be 8 constraints as per the 3rd order polynomial problem. Do I just add extra redundant variables?

Re: [RESOLVED] Equation of curve through three points.

Originally Posted by sgrya1

Why can't I get the same results? I've checked all the formulas and they all seem logical. I've also checked and rechecked the matrices a number of times

You have a typo in cell G42. You have -x_3^2 which is oddly interpreted by Excel as (-x_3)^2. The formula should be -(x_3^2). I spotted it right away because F42-I42 should just be the negatives of B42-E42. That makes the difference. Actually, F42 is also a typo, but it doesn't matter since an odd power is involved.

Originally Posted by sgrya1

BTW, how do you add a single point to the curve in excel?

If you are referring to how I put symbols only on the points of zero curvature, I didn't add new points. In Excel charts, you can selectively turn symbols on. Here's how to do it:

- Click the curve once to highlight
- Move the cursor along the curve until you find the point you want to have a symbol. If you do it slowly, Excel will tell you the coordinates of each point as the cursor passes over it
- Click once to highlight the point of interest and pause for a second
- Double click the point to bring up the Format Data Point dialog box and choose the marker you want
- Repeat for the other points for which you want markers shown

Originally Posted by sgrya1

Another question, I've found a textbook that says that I should join two 2nd order polynomials for the tendon profile. Not sure of the science behind which (2nd order or 3rd order) would be more suitable for post tensioned concrete design but I need a square matrix to invert.

Yields 6 unknowns but I still see that there should be 8 constraints as per the 3rd order polynomial problem. Do I just add extra redundant variables?

If you join two 2nd order ploys, you can only have 6 equations since there are 6 unknowns. In this case, you don't get to choose the interior point of zero curvature. You can't even enforce slope and curvature continuity at the join point. You need to specify the end points and slope, which is 4 equations. Making the join point common to both polys makes 5. That leaves 1 equation - you can enforce slope continuity or curvature continuity but not both. Try it - I doubt that you'll be very happy with the result. You simply can't enforce 8 conditions when joining two parabolas - you only get 6.

Having said that, if your textbook says you should use 2nd order equations, it is probably worth investigating more. I don't know anything about the appropriate math models for post-tensioned concrete tendon profiles.

Last edited by VBAhack; May 30th, 2007 at 12:31 AM.

Re: [RESOLVED] Equation of curve through three points.

Just to correct some sloppiness on my part. In a couple of places, I equated curvature with the 2nd derivative. They aren't the same thing, though in structures they often are since slopes are small. If y = f(x), the curvature, k is:

k = y'' / (1 + y'^{2})^{3/2}

The 2nd derivative (y'') is a major component of curvature and approximates curvature if the slope is small compared to 1. On the other hand, if the 2nd derivative is zero, the curvature is zero (provided the slope is reasonable).

Last edited by VBAhack; Jun 15th, 2007 at 05:54 PM.

Re: [RESOLVED] Equation of curve through three points.

Greetings all:

I am interested in this thread regarding calculating the profile of prestressing cables. What I have is slightly different in condition. I am no math wizard, unfortunately.

I have a beam of length L and cable profile (reverse parabola).

What I know are the following:
1. Coordinate (x1,y1) --> Profile of tendon at high point @ x = 0
2. Coordinate (x2,y2) --> Profile of tendon at low point @ x = L/2
3. Coordinate (x3,y3) --> Profile of tendon at high point @ x = L