0

I have a variable x in the interval [-30; 30]. I need to convert this interval so x would be in the interval [0; 1]. What I mean is like this:

original x:     -30 .. -20 ... -10 .... 0 .... 10 .... 20 ... 30

new x:           0  .. 0.16 .. 0.32 .. 0.5 .. 0.66 .. 0.83 ..  1

New x values correspond to the original x values. I hope you get the idea.

Cobold
  • 919
  • Just to illustrate what Travis answered, report on a plot the new $x$ as a function of the original value. Do you see what you have ? So, guess (find) the equation. Good problem ! – Claude Leibovici May 09 '15 at 18:19
  • Duplicate and more generic solution: https://math.stackexchange.com/questions/914823/shift-numbers-into-a-different-range – PatientOtter Sep 04 '22 at 17:44

1 Answers1

2

What I would do is shift and then scale... take a value $x\in [-30, 30]$ and add 30 to it. Then $x+30\in [0, 60]$. Finally, divide by 60, $(x+30)/60\in [0, 1]$.

TravisJ
  • 7,426