tags:

views:

298

answers:

6
A: 

You're probably looking for something like polynomial interpolation. A quadratic/cubic/quartic interpolation ought to give you the sorts of curves you show in the question. The differences between the three curves you show could probably be achieved just by adjusting the coefficients (which indirectly determine steepness).

Noldorin
I have looked at that, and interpolation, much like curve fitting is a case where you have a few or more discrete points that you are trying to tie together.v You then use the m = change in x/ change in y to differentiate.My case is a simple one where I want to either allow a user to enter a variable, or choose from an enum that has Steep, Average and Mild (awful names I know) to allow them to choose the steepness of the curve, much like turning the traction control off on a car and not interpolating the points as there are none at present. I need to generate them.
Try a bezier curve then: http://en.wikipedia.org/wiki/Bézier_curve
Tony Lee
Thanks, I will try this and AakashM's suggestions.
Reasons for down-vote please?
Noldorin
A: 

The graph of y = x^p for x from 0 to 1 will do what you want as you vary p from 1 (which will give the red line) upwards. As p increases the curve will be 'pushed in' more and more. p doesn't have to be an integer.

(You'll have to scale to get 0 to 100 but I'm sure you can work that out)

AakashM
x^p where p > 1 gives you a slope of 0 near 0. That doesn't look like the curves you've drawn.
Jason S
+1  A: 

I propose a simple formula, that (I believe) captures your requirement. In order to have a full "quarter circle", which is your extreme case, you would use (1-cos((x*pi)/(2*100)))*100.

What I suggest is that you take a weighted average between y=x and y=(1-cos((x*pi)/(2*100)))*100. For example, to have very close to linear (99% linear), take:

y = 0.99*x + 0.01*[(1-cos((x*pi)/(2*100)))*100]

Or more generally, say the level of linearity is L, and it's in the interval [0, 1], your formula will be:

y = L*x + (1-L)*[(1-cos((x*pi)/(2*100)))*100]

EDIT: I changed cos(x/100) to cos((x*pi)/(2*100)), because for the cos result to be in the range [1,0] X should be in the range of [0,pi/2] and not [0,1], sorry for the initial mistake.

Roee Adler
I love simple forumlae. I will certaibnly try this was well tomorrow.Thank you very much!
A: 
Jason S
I believe Rax Olgud chose the quarter circle and a circular function because a circular function moves slowly when it's near one axis and at its fastest when it's near the other axis.
Nosredna
+3  A: 
Paul Hooper
This was the solution (for me anyway). I tried this and it worked, acheiving everything that I needed. I cannot that you enough Paul, I'd been like a dog "chasing it's tail" on this one. Thanks again!
A: 

For problems like this, I will often get a few points from a curve and throw it through a curve fitting program. There are a bunch of them out there. Here's one with a 7-day free trial.

I've learned a lot by trying different models. Often you can get a pretty simple expression to come close to your curve.

Nosredna