(from Zim)
Changing ranges, like "0 - 1024" to "0 - 3.3" is fairly straight forward, but when the ranges don't start with 0, its more involved.
cicciocb set me straight on this a while back....
eg.
> inMin to inMax is the range to be measured eg. 6 - 120
> out = converted output
> outMin to outMax is the range of the desired output eg. 1 - 5
out = ((in - inMin) / (inMax - inMin) * (outMax - outMin)) + outMin
eg. if sensor reads 15 out of 120 and you want it in a "1 - 5 equivalent"
out = (in - inMin) / (inMax - inMin) * (outMax - outMin) + outMin
out = (15 - 6) / (120 - 6) * (5 - 1) + 1
out = 1.3
Mapping one range of numbers to another range
- Electroguard
- Posts: 846
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 272 times
- Been thanked: 320 times
- cicciocb
- Site Admin
- Posts: 1965
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 422 times
- Been thanked: 1310 times
- Contact:
Re: Mapping one range of numbers to another range
Now this can be done more easily with the function CONVERT.MAP
[Local Link Removed for Guests]
[Local Link Removed for Guests]