could anyone help me to solve the issue in the following matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
jaah navi
am 24 Feb. 2020
Beantwortet: jaah navi
am 24 Feb. 2020
I ma having matrix A=[
44 0 0;
0 57 0;
0 1 48]
The sum(A) is 150.
Could anyone please help me how to make the matrix such that sum of each row of the matrix be 50 under the condition the diagonal of the matrix should contain the maximum number greater than 45 and the rest of the place can have the number ranging from 1 to 5.
2 Kommentare
Walter Roberson
am 24 Feb. 2020
Well you cannot for that matrix. The second row contains 57 so the minimum sum for the row cannot be less than 57 but you need it to be 50.
Akzeptierte Antwort
Walter Roberson
am 24 Feb. 2020
P = rand(3,1)*3+45;
Q = (50 - P - 1).*rand(3,1) + 1;
R = 50 - P - Q;
A = [P, Q, R] ;
Now circshift row 2 by 1 right and circshift row 3 by 2 right.
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!