From: Nazmi Ariff on 18 May 2010 23:37 Hi all, I want to make a 1000 random data between 0 to 100 range in a 1000 row and 1 column.Now the problem is i dont how to do it.I already tried the command rand(1000,1)*1000 how ever the range are not very detail.I found that it they are no range start with 0.XXXX.So how to do it?..TQ
From: TideMan on 19 May 2010 00:08 On May 19, 3:37 pm, "Nazmi Ariff" <wonderkid...(a)gmail.com> wrote: > Hi all, > > I want to make a 1000 random data between 0 to 100 range in a 1000 row and 1 column.Now the problem is i dont how to do it.I already tried the command rand(1000,1)*1000 how ever the range are not very detail.I found that it they are no range start with 0.XXXX.So how to do it?..TQ To get a range between zero and 100, you should multiply rand by 100, not 1000. But I don't understand this: "the range are not very detail". Please explain what you mean.
From: us on 19 May 2010 02:43 "Nazmi Ariff" <wonderkid969(a)gmail.com> wrote in message <hsvmd0$9q$1(a)fred.mathworks.com>... > Hi all, > > I want to make a 1000 random data between 0 to 100 range in a 1000 row and 1 column.Now the problem is i dont how to do it.I already tried the command rand(1000,1)*1000 how ever the range are not very detail.I found that it they are no range start with 0.XXXX.So how to do it?..TQ this is a bit confusing, can you show an example(?)... us
From: Steven Lord on 19 May 2010 10:14 "Nazmi Ariff" <wonderkid969(a)gmail.com> wrote in message news:hsvmd0$9q$1(a)fred.mathworks.com... > Hi all, > > I want to make a 1000 random data between 0 to 100 range in a 1000 row and > 1 column.Now the problem is i dont how to do it.I already tried the > command rand(1000,1)*1000 how ever the range are not very detail.I found > that it they are no range start with 0.XXXX.So how to do it?..TQ Suppose I throw a six-sided die six times. Should I be guaranteed that each of the numbers 1 through 6 come up exactly once during those six throws? In fact, for the vector 1000*rand(1000, 1) to result in no values less than 1, that means the random vector created by rand(1000, 1) contained no values less than (1/1000). Since those numbers are independent, what's the probability of that happening? P = (999/1000)^1000 P is not really that small. You can check this: function results = simulation(n) if nargin < 1 n = 100000; end P = (999/1000)^1000; numSuccess = 0; for k = 1:n if any(rand(1000, 1) < (1/1000)) numSuccess = numSuccess + 1; end end numTrialsWithoutSmallValues = n - numSuccess; results = [numTrialsWithoutSmallValues; n*P; ... numTrialsWithoutSmallValues-n*P]; -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: Forcing a Java class to load Next: Add element in Multidimensional Arrays |