General Question

frankielaguna's avatar

Math algorithm/function to convert this number to 40?

Asked by frankielaguna (256points) 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

6 Answers

LuckyGuy's avatar

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

frankielaguna's avatar

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

I forgot to add the -

Sorry.

LuckyGuy's avatar

No problem. I did it in excel

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

jpwilson25's avatar

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.

LuckyGuy's avatar

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.

jpwilson25's avatar

Just learned a new Excel trick, thanks!

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther