可能重复:
MATLAB: how to normalize/denormalize a vector to range [-1;1]
matlab rescale matrix data to -1 to 1
考虑一个100x200矩阵A
,是否有一个builtin
函数(或一组builtin
函数)将A
的范围设置为任意比例?< / p>
答案 0 :(得分:3)
这有资格吗?
R = [.5 .9];
dR = diff( R );
A = A - min( A(:)); % set range of A between [0, inf)
A = A ./ max( A(:)) ; % set range of A between [0, 1]
A = A .* dR ; % set range of A between [0, dRange]
A = A + R(1); % shift range of A to R