1

I want to map a time (0 to about 100.000 seconds, in ms) to a byte [0 to 256):

f(x) = ???

where 0 <= x    <= 100,000
      0 <= f(x) <= 255

Of course I will lose some accuracy, however I want the values between around 0.5 to 10 seconds to lose less accuracy than other values. So I want e.g. between 0.5 and 10 seconds to be mapped to e.g. 30 to 220 and (like in the picture below).

The function should look more or less like the picture below.

What should I put in the question marks of the formula to get a similar function as the graphic?

enter image description here

1 Answers1

1

There are of course many, many ways of coming up with this kind of function. An important tool for crafting curves with desired shape/slope are splines; in particular I recommend looking into Hermite splines (and Catmull-Rom splines).

user7530
  • 49,280