Filter löschen
Filter löschen

Row unity in matrix

2 Ansichten (letzte 30 Tage)
Harini Mahendra Prabhu
Harini Mahendra Prabhu am 24 Sep. 2020
Beantwortet: Steven Lord am 24 Sep. 2020
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

Akzeptierte Antwort

Sindar
Sindar am 24 Sep. 2020
P_norm = P./sum(P,2);

Weitere Antworten (1)

Steven Lord
Steven Lord am 24 Sep. 2020
>> P = rand(9);
>> NP = normalize(P, 2, 'norm', 1);
>> sum(NP, 2)
ans =
1
1
1
1
1
1
1
1
1

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by