for example i have two ranges
(1) 0 to 3
(2) 10 to 15
in range (1) i have numbers between 0 and 3, where 0 is minimum and 3 is maximum value…(it has also values 1 and 2)…
now i wanted to rescale both ranges (1) and (2) to range 0 to 1. Can you show me how to do it or at least point to helpful sites? thanks a lot!
What you’re describing is called linear interpolation.
For the general case, suppose you have a value
cbetweenaandb, and you want a valuexbetween 0 and 1 which is based onc‘s relative position betweenaandb. The equation forxis as follows:So if you have a value between 10 and 15 (let’s say 11), and you want a value between 0 and 1, you punch the values into the equation above:
In other words, 11 is one-fifth of the way from 10 to 15.
The even more general case (when you have a value
cbetweenaandband you want a valuexbetweenyandz),xis calculated as follows:In your case,
z = 1andy = 0.