Curve FittingDate: 03/08/97 at 20:23:39 From: Aaron Hardinger Subject: Calculating the function for a curved line Hello, I am using the equation ax^3+bx^2+cx+d and also its derivative 3ax^2+2bx+x. Asuming that f(0) = 0 and f'(0) = 0, I need to get an equation that will give me 'a' and another one to give me 'b'. By this I mean an equation that I can plug c and d into to get either a or b out. Then the second equation will give me the value of the remaining variable if I plug in c, d and either a or b. I have tried this several times. I keep getting a different equation and worse, the results, a and b, are different with each set with a given value of slopes and ending x. As you can see, I am trying to write a computer algorithm that will produce a curved line with a starting point of (0,0) and an ending point of some x and some y. This line also starts with slope1 and ends with slope2. Given this equation, ax^3+bx^2+cx+d, are there any limits to the slopes? It seems that in some cases the curve looks good while others are way out there. I found that if the starting slope is zero, then the ending slope can be anything and looks great! But the moment that the initial slope changes to something not equal to 0, the curve looks very bad! If you could please help me with this I would be very thankful. I have been stuggling for a long time trying to get this to work. If the equation I mentioned earlier is not be that versatile, could you please give me some other equations and explain how to derive the end equation from it? Thank you very much for your time, Aaron Hardinger Date: 03/10/97 at 08:45:11 From: Doctor Jerry Subject: Re: Calculating the function for a curved line Hi Aaron, From what you say to begin with, it seems you are are trying to fit a cubic to certain data. For example, you want the graph to pass through the origin (f(0) = 0) and you want the slope to be 0 there (f'(0) = 0). This requires: f(0) = d = 0 and f'(0) = c = 0 (The derivative of ax^3+bx^2+cx+d is 3ax^2+2bx+c, not 3ax^2+2bx+x, as you wrote.) So, the cubic must be f(x) = ax^3+bx^2. Any choice of a and b will give a cubic polynomial f for which f(0) = 0 and f'(0) = 0. But from what you say at the end of your message, maybe you mean that f'(0) = 1. In this case: f(0) = d= 0 and f'(0) = c = 1 So, the cubic is f(x) = ax^3+bx^2+x. To choose a and b you need to require more than f(0) = 0 and f'(0) = 1. The slope function for the above result would be 3ax^2+2bx+1. Depending on a and b, yes, the slope can be very large away from the origin. At the origin, we have forced it to be 1. It is known that fitting data with polynomials often does not give very satisfactory results. Some use Bezier curves, others use splines. Depending on your data, you might want to fit using some kind of exponential model. You are working with a subject with a long history and quite a few possible pitfalls. -Doctor Jerry, The Math Forum Check out our web site! http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/