From: Shkelzen on 25 Nov 2009 09:44 I have to generate in matlab a matrix with main diagonal zero, with row sum equal to 1 and to be symetrix. Please can anybody help me to give the .m file or to give some advices.
From: Matt on 25 Nov 2009 10:20 "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hejfs5$r8k$1(a)fred.mathworks.com>... > I have to generate in matlab a matrix with main diagonal zero, with row sum equal to 1 and to be symetrix. Please can anybody help me to give the .m file or to give some advices. A=[0,1;1,0];
From: Jos (10584) on 25 Nov 2009 10:26 "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hejfs5$r8k$1(a)fred.mathworks.com>... > I have to generate in matlab a matrix with main diagonal zero, with row sum equal to 1 and to be symetrix. Please can anybody help me to give the .m file or to give some advices. Here is some code for starters: A = rand(4) q1 = tril(true(4),-1) q2 = triu(true(4),1) A(q1) = A(q2) % symmetry A(eye(4)==1) = 0 % set diagonal to zero help rand help diag help eye help tril help triu hth Jos
From: Shkelzen on 26 Nov 2009 07:31 I gonna try Thank you! "Jos (10584) " <#10584(a)fileexchange.com> wrote in message <hejiar$3q9$1(a)fred.mathworks.com>... > "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hejfs5$r8k$1(a)fred.mathworks.com>... > > I have to generate in matlab a matrix with main diagonal zero, with row sum equal to 1 and to be symetrix. Please can anybody help me to give the .m file or to give some advices. > > Here is some code for starters: > > A = rand(4) > q1 = tril(true(4),-1) > q2 = triu(true(4),1) > A(q1) = A(q2) % symmetry > A(eye(4)==1) = 0 % set diagonal to zero > > help rand > help diag > help eye > help tril > help triu > > hth > Jos
From: Shkelzen on 3 Dec 2009 05:11
I try the way u tll me, the matrix is OK exept the fact that dont have rows sum equale to 1. Please can u help me make this matrix or is inposible to do a matrix like this. Thx again !! "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <helsem$d7p$1(a)fred.mathworks.com>... > I gonna try > Thank you! > > "Jos (10584) " <#10584(a)fileexchange.com> wrote in message <hejiar$3q9$1(a)fred.mathworks.com>... > > "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hejfs5$r8k$1(a)fred.mathworks.com>... > > > I have to generate in matlab a matrix with main diagonal zero, with row sum equal to 1 and to be symetrix. Please can anybody help me to give the .m file or to give some advices. > > > > Here is some code for starters: > > > > A = rand(4) > > q1 = tril(true(4),-1) > > q2 = triu(true(4),1) > > A(q1) = A(q2) % symmetry > > A(eye(4)==1) = 0 % set diagonal to zero > > > > help rand > > help diag > > help eye > > help tril > > help triu > > > > hth > > Jos |