Normalizing to the maximum value

조회 수: 21 (최근 30일)
Anwesh Saha
Anwesh Saha 2023년 2월 3일
댓글: Star Strider 2023년 2월 3일
I have a 48X128 matrix. I want to normalize each row to the maximum value in that row. What function will achieve this?

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 2월 3일
편집: Sulaymon Eshkabilov 2023년 2월 3일
Use normalize() to normalize each row or use simple matrix operation to obtain the values of matrix elements to be between [0 .. 1]:
A = randi(10, 7 , 5) % Data
A = 7×5
8 8 2 7 10 3 2 9 10 7 2 10 1 6 10 2 2 10 5 6 8 9 7 5 8 2 3 9 3 8 2 7 3 6 10
An = normalize(A,2) % Normalize each row
An = 7×5
0.3333 0.3333 -1.6667 0 1.0000 -0.8979 -1.1785 0.7857 1.0663 0.2245 -0.8907 0.9845 -1.1251 0.0469 0.9845 -0.9045 -0.9045 1.5076 0 0.3015 0.3956 1.0550 -0.2638 -1.5825 0.3956 -0.9258 -0.6172 1.2344 -0.6172 0.9258 -1.1217 0.4362 -0.8101 0.1246 1.3710
ANor = A./max(A(1:end,:)) % Normalize wi.r.t. max value of each row
ANor = 7×5
1.0000 0.8000 0.2000 0.7000 1.0000 0.3750 0.2000 0.9000 1.0000 0.7000 0.2500 1.0000 0.1000 0.6000 1.0000 0.2500 0.2000 1.0000 0.5000 0.6000 1.0000 0.9000 0.7000 0.5000 0.8000 0.2500 0.3000 0.9000 0.3000 0.8000 0.2500 0.7000 0.3000 0.6000 1.0000
  댓글 수: 1
Star Strider
Star Strider 2023년 2월 3일
the normalize function defaults to normalising by 'zscore' . For other options, see the documentation section on method.

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by