Row unity in matrix

4 ビュー (過去 30 日間)
Harini Mahendra Prabhu
Harini Mahendra Prabhu 2020 年 9 月 24 日
回答済み: Steven Lord 2020 年 9 月 24 日
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 日
P_norm = P./sum(P,2);

その他の回答 (1 件)

Steven Lord
Steven Lord 2020 年 9 月 24 日
>> P = rand(9);
>> NP = normalize(P, 2, 'norm', 1);
>> sum(NP, 2)
ans =
1
1
1
1
1
1
1
1
1

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by