Sign in to follow this  
Will-O

non linear ratios

Recommended Posts

Will-O    122
For values x: (0, xMax), where xMax is user defined, the values are evenly spaced and linear. The y values must start at one and should tend to zero over the range ofd x values. Before the application of a modifier function to x, the equation describing how x and y relate to each other is: y = 1 - x/xMax. This isn't very interesting or realistic for my purpose. Two others I'm using are
INVERSE:
y = 1/(x+1)  // need to make it x+1 because when n/0 = error & when x = 0  y = 1
             // y only tends to 0 as x-> infinity
             // also initial fall of is too rapid

COSINE:
linear = x/xMax;             // good core shape but as the range of x-values
y = (cos(linear * PI) + 1)/2 // increases it becomes quite flat though it
                             // can be improved by re-applying f'n to result

I'm looking for a bell-shaped curved like the right-hand-side of a normal distribution curve, or a signal function (though these are y: (0, 1) so technically it'd be a -ve signal, which I'm not sure exists). However, other than the cosine one above and doing some very protracted stuff with sinh and ln I haven't had much joy. I am numerically able but looking through mathematical stuff on the web all of a sudden I am very aware that I have become completely ignorant of the proper syntax and nomenclature so please make suggestions readily digestible to the layman! If I haven't been clear please ask and I'll try to specify. Thank you in advance for you help.

Share this post


Link to post
Share on other sites
Lord Crc    234
Perhaps it's better if you explain what you need this for, or how you intend to use it?

edit: that is, since you're looking for a bell curve, but not using it, is there any particular reason?

Share this post


Link to post
Share on other sites
raigan    1110
Alternately, rather than trying to find a function that produces the shape you want, you could always just use a lookup table (interpolated linearly or with splines) -- that way you can draw in the exact response you want.

Share this post


Link to post
Share on other sites
MrRowl    2490
Write y = A + Bx + Cx^2 + Dx^3
so
dy/dx = B + 2Cx + 3Dx^2

when x = 0, you know y = 1 and dy/dx = 0

when x = xmax, you know y = 0 and dy/dx = 0

Gives you 4 equations, though two are trivial (A = 1 and B = 0). Solve the remaining two, and you have a simple polynomial that fits the boundary conditions, and smoothly goes from 1 to 0 over the range.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this