# Math algorithm/function to convert this number to 40?

Asked by frankielaguna (256) June 23rd, 2010

I’m programming a knob that has an arrow that’s position is defined from an arc number.

I’m looking to find a way to convert this arc number to a number that will represent a temperate.

The minimum this number will be is 1.3 and the maximum this number will be is 1.7

1.3 needs to equal 40 and 1.7 needs to equal 99

Is this possible?

Observing members: 0 Composing members: 0

Sure the equation is y = 147.5x – 151.75
Where x is the number that goes from 1.3 to 1.7
And Y is the one that goes from 40 to 90.

If you want it the other way let me know.

Here it is:
y = 0.0068x + 1.0288

Enjoy

LuckyGuy (36524)

How would the function change if the minimum number is -1.3?

I forgot to add the -

Sorry.

No problem. I did it in excel

y = 19.667x + 65.567
or
y = 0.0508x – 3.3339

LuckyGuy (36524)

You mind sharing how you did this in Excel? It would be useful should he ever need to make another range conversion—plus I’m intrigued.

jpwilson25 (266)

Sure. First, I started to solve the equations mathematically like we learned in 8th grade.

Then I got lazy and decided to check it by making a short table of the four numbers.
x y
-1.3 40
1.7 99
And hit “Insert” “Scatter plot” Then selected “Add Trend line” “Linear” “Show equation”.

I then swapped the two columns and did it again. It took less than 4 minutes.

LuckyGuy (36524)

Just learned a new Excel trick, thanks!

jpwilson25 (266)

or