inverse/opposite of linedrive's curve?
Hi all
I'm vaguely familiar with creating exponential mapping, through the 5th argument to [scale] and the third argument to [linedrive] for example. Is it possible to 'generically' change an exponential INPUT to linear OUTPUT? I realise this will be vague, without knowing what the original exponent(?) is, but I simply don't. I'm remapping the response from a Sharp GP2D12 infra-red range sensor, and the data sheet indicates a non-linear response, but no formula as such; the response graph is here:
http://www.parallax.com/dl/docs/prod/acc/SharpGP2D12Snrs.pdf
Can I "flatten the curve" in anyway, perhaps with [expr]?
Thanks
Brendan
ps logarithms frighten me :)
Not sure I understand what you want to achieve. The non-linear voltage vs distance relation is given by the device and cannot be changed as such. Choosing a non-linear (logarithmic) scale for voltage or distance may flatten the curve but that's just a cosmetic change of the graphical representation.
Hi broc
thanks for the response; yes the actual response curve is fixed and I am looking for a logarithmic solution to flatten that response, such that the maximum distance results in 0, half the distance = 127/2, 1/4 distance = 127/4 etc.I have tied the Arduino serial data to a slider in Max, it is slow and smooth (< c. 50) in the first 3/4 of distance/range then rises sharply to 127 over the last quarter of remaining distance/range. I'm just looking for a more linear response..
thanks
Brendan
You could try an experimental approach, ie. use a live.slider and play with the 'Exponent' parameter.
Values between 0.5 and 1 may be suitable for compensating the non-linear response (to some degree).
Hi broc
thanks again; I tried your suggestion but the Exponent attribute has no effect on the response.
I know that setting the exponent in [scale] to < 1. has no effect so I thought your suggestion would work - is there an [expr] solution?
i.e. I gazed out the window during Maths class
Apparently intuition doesn't work here.
So a true math expert is needed...
I thought it would work too :)