how to normalize a matrix?????

3 次查看(过去 30 天)
abdulkader helwan
abdulkader helwan 2014-10-22
hello everyone... i need a code to normalize( between 0 and 1) a matrix 7*50. the normalization process should be for each column not row**. in other words, the program should seek for the largest value in each column and divide all the elements in that column by it. can anybody help plzz

回答(3 个)

James Tursa
James Tursa 2014-10-22
编辑:James Tursa 2014-10-22
Assuming values are positive, e.g.,
M = your matrix
N = bsxfun(@rdivide,M,max(M)); % Normalized (scaled) matrix by column

Greg Heath
Greg Heath 2014-10-23
rng('default')
A = 100*randn(3)
Amin = repmat(min(A),3,1)
Amax = repmat(max(A),3,1)
a = (A-Amin)./(Amax-Amin)
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 个评论
Image Analyst
Image Analyst 2014-10-25
abdulkader's "Answer" moved here:
thnaks bro.. that was helpful

请先登录,再进行评论。


Steven Lord
Steven Lord 2021-2-22
Use the normalize function with a dim input and the 'range' normalization method.

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by