Hi All,
I am struggling to figure out a working calculation for gain (feel free to tell me the correct terminology, it's just how I understand it).
Problem:
I am writing a software program that needs to convert an input value to a scaled output value over a range between 13(min value) and 1300(max value).
So:
Inputting a value of 13 needs to generate 9000.
inputting a value of 1300 needs to generate 0 (If zero is not possible, a value of 100 would work).
Normally, to calculate this I would divide the input by the required output to generate a gain (13/9000=0.00144444444444444444444444444444), therefore dividing the input number by the gain would generate the correct output, and a single gain works across the whole scale.
However, in the above case this does not work as the output needs to decrease as the input increases.
so:
13/0.00144444444444444444444444444444= 9000 (correct)
13000/0.00144444444444444444444444444444= 9000000 (incorrect, the gain for this needs to be 100/1300 = 0.07692307692307692307692307692308 (using 100 instead of zero)
Any ideas please?
Thanks,
Steve
I am struggling to figure out a working calculation for gain (feel free to tell me the correct terminology, it's just how I understand it).
Problem:
I am writing a software program that needs to convert an input value to a scaled output value over a range between 13(min value) and 1300(max value).
So:
Inputting a value of 13 needs to generate 9000.
inputting a value of 1300 needs to generate 0 (If zero is not possible, a value of 100 would work).
Normally, to calculate this I would divide the input by the required output to generate a gain (13/9000=0.00144444444444444444444444444444), therefore dividing the input number by the gain would generate the correct output, and a single gain works across the whole scale.
However, in the above case this does not work as the output needs to decrease as the input increases.
so:
13/0.00144444444444444444444444444444= 9000 (correct)
13000/0.00144444444444444444444444444444= 9000000 (incorrect, the gain for this needs to be 100/1300 = 0.07692307692307692307692307692308 (using 100 instead of zero)
Any ideas please?
Thanks,
Steve