Hi there,
I've created a random 9 times matrix using the command:
P = rand(9,9)
How do I make sure that the rows in each of the matrix are equal to one when added?
Any help will be appreciated!
Thanks

 채택된 답변

Sindar
Sindar 2020년 9월 24일

0 개 추천

P_norm = P./sum(P,2);

추가 답변 (1개)

Steven Lord
Steven Lord 2020년 9월 24일

0 개 추천

>> P = rand(9);
>> NP = normalize(P, 2, 'norm', 1);
>> sum(NP, 2)
ans =
1
1
1
1
1
1
1
1
1

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2020년 9월 24일

답변:

2020년 9월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by