From: Jos (10584) on 3 Dec 2009 07:49 "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hf82rp$khq$1(a)fred.mathworks.com>... > 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. Question 1 if you have two numbers, like [1 2], how would you transform them to make them sum to 1, but still keep the first half the second number? Question 2 What if you have more numbers [1 2 8 4]?
From: Shkelzen on 4 Dec 2009 11:33 "Jos (10584) " <#10584(a)fileexchange.com> wrote in message <hf8c3v$28r$1(a)fred.mathworks.com>... > "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hf82rp$khq$1(a)fred.mathworks.com>... > > 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. > > Question 1 > if you have two numbers, like [1 2], how would you transform them to make them sum to 1, but still keep the first half the second number? > > Question 2 > What if you have more numbers [1 2 8 4]? 1.To make the sum 1, one method that i have try is to devide with the row sum. For ex. [1/3,2/3]. Note: The matrix is random. 2. The same method can be use for more numbers.
From: Jos (10584) on 4 Dec 2009 17:19
"Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hfbdki$ms9$1(a)fred.mathworks.com>... > "Jos (10584) " <#10584(a)fileexchange.com> wrote in message <hf8c3v$28r$1(a)fred.mathworks.com>... > > "Shkelzen " <goxhjas(a)yahoo.com> wrote in message <hf82rp$khq$1(a)fred.mathworks.com>... > > > 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. > > > > Question 1 > > if you have two numbers, like [1 2], how would you transform them to make them sum to 1, but still keep the first half the second number? > > > > Question 2 > > What if you have more numbers [1 2 8 4]? > > 1.To make the sum 1, one method that i have try is to devide with the row sum. For ex. [1/3,2/3]. Note: The matrix is random. > > 2. The same method can be use for more numbers. Right! Now apply this to each row of the 2D array and you're done. Take a look the function SUM, for-loops and bsxfun. hth Jos |