Home > Blockchain >  I have values withing the range of 0-5 but I need to convert them from 1-5 range
I have values withing the range of 0-5 but I need to convert them from 1-5 range

Time:10-02

I have CSV file from one of our device with the range of 0-5 volts. But I need to convert this range from 0-5 to 1-5 volts to use it in another application. I have tried with "Convert a number range to another range, maintaining ratio". This equation is not working with value 0=1 & 5=5. It is changing the 1st & last values. For example-

NewValue = (((OldValue - OldMin) * (NewMax - NewMin)) / (OldMax - OldMin))   NewMin
Old MIn- 0, Old max-5
New Min- 1, New Max-5

Let's use old value=5

New value= (((5-0)* (5-1))/(5-0) 1)

The answer for new value comes out as 3.3333 but I need the max value to be 5 & min value to change from 0=1. If I follow the same method 0 comes out as 0 not 1.

This is the one equation I tried but it is not working well.

I need a conversion of range 0-5 volts into the 1-5 volts.

CodePudding user response:

((5-0)* (5-1))/(5-0) 1 is 5 not 3.3333. Perhaps you are trying this out on a calculator and having trouble entering the expression? In any event, in this case the computation simplifies to

new_value = (4/5)*old_value   1
  • Related