Re: Looking for function (x,y)
- From: Steve555 <foursheds@xxxxxxxxxxxxxx>
- Date: 27 Apr 2007 03:12:15 -0700
On 26 Apr, 22:35, donald.patter...@xxxxxxxxx wrote:
On Apr 26, 2:27 pm, Steve555 <foursh...@xxxxxxxxxxxxxx> wrote:
Hi,
I'm looking for a function similar to y = x from 0 to 1, where (0,0)
and (1,1) are fixed, but with tuneable parameters to give a
symmetrical convex or concave curve in between.
(I'm writing C code to allow the user to shape the output of an
oscillator).
Could this be done with one function, or would I need three (concave,
linear, convex) ?
Thanks for any advice
Steve
hi,
plotting y=x^n for various values (1/n for convex) might do what you
need, but that's probably not symmetric...
another way would to be to rotate the function y=x(1-x) to the
right location, since that's definitely symmetric about the line
x=1/2. to do this you would need your function to be parametric, but
on the plus side, there's only one parameter to tune. you can do this
by writing y=cx(1-x) in parametric form, ie x(t) = t, y(t) = ct(1-t)
for t=0..1 then apply a rotation (and stretch so that the function
ends up at (1,1))
in the end, you get the function f(t) = [x(t), y(t)]
where x(t) = t + c(t^2 - t)
and y(t) = t - c(t^2 - t)
and t goes from 0 to 1
then different c values will give you different symmetric concave,
convex and linear curves (c>0 gives convex, c=0 for linear, c<0 for
concave)
does this help/make sense?
Donald
It didn't make sense at first, but I'm glad I persevered and plotted
it! This is closest to what I was originally visualising, and it
appears to give a constant amount of bulge/sag for changes in c.
Thanks!, I learned a lot from going through this. The fly-in-the-
ointment, though, is that to get as extreme curvature in to the
corners (0,1), (1,0), as Randy's solution, y can exceed 1, or go below
0, which for my oscillator would result in distortion.
.
- References:
- Looking for function (x,y)
- From: Steve555
- Re: Looking for function (x,y)
- From: donald . patterson
- Looking for function (x,y)
- Prev by Date: Re: Looking for function (x,y)
- Next by Date: Re: Matrix (Lie) group puzzle
- Previous by thread: Re: Looking for function (x,y)
- Next by thread: Re: Looking for function (x,y)
- Index(es):
Relevant Pages
|