How do I code to normalize a matrix by dividing each index by the max abs value in the row

조회 수: 3 (최근 30일)
A = input('Enter matrix for normalization:'); [x,y] = size(A);
z=abs(C); m=0; n=0;
for i=1:x
end
disp(n)

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 11일
편집: Azzi Abdelmalek 2013년 9월 11일
A=[2 7;8 10]
out=A/max(abs(A(:)))
  댓글 수: 2
Sterlin
Sterlin 2013년 9월 12일
Thanks Azzi. That definitely shortened my code and I learned a new command.
Jan
Jan 2013년 9월 12일
But this does not solve the question: "dividing each index by the max abs value in the row".

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2013년 9월 12일
A = [2 7;8 10];
m = max(abs(A), [], 2);
B = bsxfun(@rdivide, A, m);

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by