- The original call has the parameter vector SUPPX repeated twice (once in the cell array and again explicitly) which is clearly wrong, and
- The use of "the curlies" to dereference the cell array in the working call wherein the duplicate SUPPX array has been expunged.
random function and its properties'?
3 views (last 30 days)
Show older comments
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!!
0 Comments
Answers (1)
dpb
on 19 Feb 2015
Edited: dpb
on 19 Feb 2015
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:
Surely this isn't supposed to have actually been working somewhere?
0 Comments
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!