I'm trying to figure out an equation that would transform a number in a range [A,B] to [0,1]. However, if the number is outside that range, then it should return 0.
Can you please help ? For simplicity, the range can be [0,A]
Thanks
I'm trying to figure out an equation that would transform a number in a range [A,B] to [0,1]. However, if the number is outside that range, then it should return 0.
Can you please help ? For simplicity, the range can be [0,A]
Thanks
The best way I can see to do this is piecewise. Let $$ f(x) = \left\{\begin{array}{ll} 0 & x < A\\ \frac{x-A}{B-A} & A\le x \le B \\ 0 & x >B\end{array}\right.$$