Exponential graph using arduino

Hello Community,

I am interfacing funduino joystick shield with Arduino Leonardo

I am trying to impose PWM logic over the joystick data

If I set the constant to 5 it should increase the sensitivity linearly, if I set it to the values < 5 or > 5 it should increase exponentially

In the graph I attached below, I want the values of Ry (Y value at the magnitude of 5 with R = 0.3), By (Y value at the magnitude of 5 with R = 0.7) and Gy (Y value at the magnitude of 5 with R = 0.5) at the magnitude % of 5

X axis has the magnitude in range of 0-10 and Y-axis has the time interval in range of 0-100

I tried using the map function of the arduino
AND also tried plotting using the parabolic equations
but hard luck!!!

i have an awk script that generates the plot below

# bending a curve

awk '

function expp (k, col)  {
    printf "\nnext\ncolor=%s\n", col
    for (i = 0; i <= I; i++)  {
        printf " %8.4f %8.4f\n", i, (exp(k*i/I) - exp(0)) / (exp(k) - exp(0))
    }
}

function straight (col)  {
    printf "\nnext\ncolor=%s\n", col
    for (i = 0; i <= I; i++)  {
        printf " %8.4f %8.4f\n", i, i / I
    }
}

BEGIN  {
    I = 20
    k = -.4

    straight("red")

    N = 9
    for (n = -N; n <= N; n += 2)
        expp( n, "cyan")

    printf "title   %s\n", "Exponential Stretching"
}' | tee expStretch.xgr

so you know your curves goes through (0, 0) (10, 100) and (5, 100xR) where R is in ]0, 1[ interval

you have 3 points and if you want a second degree polynomial equation y = a x2 + b x + c

then using the 3 points:
(0,0) ➜ 0 = c
(10, 100) ➜ 100 = 100a + 10 b // as we know c is null
(5, 100.R) ➜ 100.R = 25 a + 5b

it's a simple 2 equations, 2 unknowns and solving it gives
a = 2 - 4R
b = 40R - 10
c = 0

Challenge with this approach is that the curve won't look like your drawing as in the constraint we have not set that you want only a monotonously increasing function. Reality is it's not a 2nd degreee polynomial expression that you want.

➜ another alternative to the code above, have a look at Bezier curves

You still want to use R to define the point (0, 100.R) where R is in ]0, 1[ interval and it's going to be your control point.