- 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'?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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:
Surely this isn't supposed to have actually been working somewhere?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!