Path: news.mathworks.com!not-for-mail From: "Siddhartha " <siddhsam@hotmail.com> Newsgroups: comp.soft-sys.matlab Subject: Re: Simulation of 5 Random Variables with Sum Constraint Date: Thu, 28 Mar 2013 20:08:06 +0000 (UTC) Organization: Intel Corp Lines: 23 Message-ID: <kj27v6$k1c$1@newscl01ah.mathworks.com> References: <kivm23$ip1$1@newscl01ah.mathworks.com> <kivnv1$ohm$1@newscl01ah.mathworks.com> <kj05fc$1q1$1@newscl01ah.mathworks.com> <kj1lbg$fmj$1@newscl01ah.mathworks.com> <kj1m5i$il9$1@newscl01ah.mathworks.com> Reply-To: "Siddhartha " <siddhsam@hotmail.com> NNTP-Posting-Host: www-05-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1364501286 20524 172.30.248.37 (28 Mar 2013 20:08:06 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Thu, 28 Mar 2013 20:08:06 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 3857760 Xref: news.mathworks.com comp.soft-sys.matlab:792219 > When adding the bound constraints, there is some work to be done before apply this FEX. Please see this thread: > www.mathworks.com/matlabcentral/newsreader/view_thread/324503 > > There, Roger also has derived a special formula for uniform random sample in a n-dimensional simplex. Thanks for the info Bruno, but the simplex generation seems to strike me as a little odd, especially as seeing that there is no fixed sum constraint. Let me redefine the problem better. a1 = [10 20 35]; a2 = [13 19 35]; a3 = [12 22 35]; a4 = [15 20 35]; a5 = [11 19 35]; %Above are detailed the discrete possibilities for each of the 5 variables. %There is a 30% chance of low and high, and a 40% chance of base. Now, these random variables are basically percentages. So their sum can never exceed 100. But from some data we know that they can actually never exceed 98. I think, maybe, one can use randfixedsum for each value from min(a1) + min(a2) + min(a3) + min(a4) + min(a5) until 98, in a for loop, but again - that seems inefficient and slow, and I'm having difficulty applying it to the discrete distribution above.