how to normalize a matrix?????

조회 수: 3 (최근 30일)
abdulkader helwan
abdulkader helwan 2014년 10월 22일
답변: Steven Lord 2021년 2월 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에서 MATLAB에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by