random function and its properties'?

3 ビュー (過去 30 日間)
Cladio Andrea
Cladio Andrea 2015 年 2 月 19 日
編集済み: dpb 2015 年 2 月 19 日
Hello everyone, i have one line of code that shows a distribution of random arrivals , but what i want to understand here is that , what is the inputs here?
random(DATADISTROX,SUPPX,NUMMACHINES,1)
ok NUMMACHINES=200;
SUPPX=[0,200]
DATADISTROX={'unif',SUPPX(1),SUPPX(2)};
so in the end we have what actually? what is that random doing here? Randomly and uniformly locating machines in a given x area? and also what is 1 in the end? Please help me i am so confused!!

回答 (1 件)

dpb
dpb 2015 年 2 月 19 日
編集済み: dpb 2015 年 2 月 19 日
So am I...the above doesn't work at least w/ R2012b...
>> NUMMACHINES=200;
SUPPX=[0,200];
DATADISTROX={'unif',SUPPX(1),SUPPX(2)};
>> r=random(DATADISTROX,SUPPX,NUMMACHINES,1);
Error using random (line 75)
The NAME argument must be a distribution name.
>>
Looks to me that it's an attempt to encapsulate the call
>> r=random('unif',SUPPX(1),SUPPX(2),NUMMACHINES,1);
>> whos r
Name Size Bytes Class Attributes
r 200x1 1600 double
>>
which would create as shown a column vector of 200 PRVs from a uniform distribution between [0 200]. Maybe there's some other version that will accept the cell array???
ADDENDUM
The following does work, however...
>> r=random(DATADISTROX{:},NUMMACHINES,1);
>> whos r
Name Size Bytes Class Attributes
r 200x1 1600 double
>>
NB:
  1. The original call has the parameter vector SUPPX repeated twice (once in the cell array and again explicitly) which is clearly wrong, and
  2. The use of "the curlies" to dereference the cell array in the working call wherein the duplicate SUPPX array has been expunged.
Surely this isn't supposed to have actually been working somewhere?

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by