Skip to content

rescale

general · scripts/general/rescale.m

: b = rescale (a)
: b = rescale (a, l, u)
: b = rescale (…, "InputMin", m, "InputMax", mm)

Linearly map the elements of a onto the interval [l, u] (default [0, 1]).

Elements are first limited to the input range [m, mm], which defaults to the smallest and largest element of the whole array. m and mm may be arrays that broadcast against a. NaN elements stay NaN. If the input range is empty or degenerate, every element above mm maps to u and the others to l.