1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Range mapping

  1. Jun 26, 2009 #1
    Hey! I have a really easy question here, but I still can't figure it out.

    I have a range of values from 182 to 455. I need a function that gives me back values from 1-50. IE, f(318) = 25. The numbers aren't critical, but I'd love a general equation to use for this kinda stuff. Can anybody help me out?

  2. jcsd
  3. Jun 26, 2009 #2


    User Avatar
    Science Advisor

    The simplest equation would be linear.

    f(x)=1 + 49*(x-182)/(455-182)

    There are obvious many other possibilities depending on the information you have.
  4. Jun 26, 2009 #3
    will that form work for just about anything?

    given: 1 = x1, 50 = x2, 182 = y1, 455 = y2:
    f(n) = x1 + (x2 - 1)*(n - y1)/(y2 - y1)
  5. Jun 27, 2009 #4


    User Avatar
    Science Advisor

    Yes: after fixing typo - should have (x2-x1)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook