1
$\begingroup$

Say for example I have a list of n numbers. I would like to convert this into another list of n numbers which are all within a certain range, e.g. 0 and 1, but still maintain the relationship between the numbers in the original list. So the largest number in the first list would now be 1, the smallest 0, and all the numbers in between would have a value between 0 and 1 corresponding to their relative distance to those extremes.

So if the first list were some values from the function $y = x^2$ and I converted it into this new format and rendered a graph from that, the graph would still have the same shape, but it would be "compressed" to values between 0 and 1 only.

I thought it was called normalization but after Googling I suspect I was wrong. Is there a term for this? Can anyone point me to an algorithm to do this for any input list?

E.g. given the list {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5} I would want something like {0, 0.1, 0.2, 0.3, 0.4, ,0.5, 0.6, 0.7, 0.8, 0.9, 1}

Thanks!

  • 0
    "Normalization" sounds $f$ine to me, too. If I understood your example correctly, an alternative might be "linearly scaling" or some such.2011-10-26

1 Answers 1

1

Based on what people have said (thanks!) and subsequent googling I think it is fair to call this normalisation.

For the interested, I found an algorithm to do this. To convert a list of numbers from n to m to be between 0 and 1:

Find the min and the max of the list then for each i: n, ..., m the new value is 2 * (i - min)/( max - min)

(Taken from https://stackoverflow.com/questions/3460905/scale-a-list-of-numbers-to-be-between-1-0-and-1-0)

  • 0
    BTW, Arduino has the map() function to "convert" sensor date from an ADC to other ranges of data.2013-10-18