Any genius out there can help me figure out a single equation for DataUnitValue. My mathematics skill does not serve me well at this time. This works out ok, but I was concern what is the single equation for this?
Thank you
Thank you
B4X:
Dim Val, TotalVal, GridMax, GridMin, DataUnitValue As Float
'Plug in any of these DataUnitValue will equal 0.5. What is the single equation for this???
'GridMax = 100: GridMin = -40: Val = 30
'GridMax = 100: GridMin = 10: Val = 45
'GridMax = -10: GridMin = -50: Val = -30
TotalVal = GridMax - GridMin
If GridMin > 0 Then
DataUnitValue = (((Val - GridMin)/TotalVal) * 8) 'PART A: EQUATION USED FOR MIN VALUE ABOVE 0
Else
DataUnitValue = (((Val + Abs(GridMin))/TotalVal) * 8) 'PART B: EQUATION USED FOR MIN VALUE BELOW 0
End If
'Need to equal for 0.5 for the equation to be accurate, using the val above.