Prev: VisualDSP link fails
Next: Joystick Input
From: leo nidas on 26 Sep 2009 07:39 Hi there, I am a little confused about restating the seed. When I start matlab: x=exprnd(3,1,4) ans=0.6147 0.2968 6.1910 0.2718 rand('twister', 5489); x=exprnd(3,1,4) ans=0.6147 0.2968 6.1910 0.2718 This way I restate the seed and get the same 4 numbers. But when I do the same thing using the t distribution I get different numbers every time: rand('twister', 5489); e=trnd(4,1,4) ans=-0.4345 0.2977 1.2835 -1.0839 rand('twister', 5489); e=trnd(4,1,4) -1.6056 -0.6233 1.2819 -0.5769 I would like to able to get the same random numbers when restating the seed and use the t distribution. Is it possible? Am I doing something wrong? Thanx in advance for any answers.
From: Peter Perkins on 26 Sep 2009 09:33 leo nidas wrote: > rand('twister', 5489); > e=trnd(4,1,4) > ans=-0.4345 0.2977 1.2835 -1.0839 > rand('twister', 5489); > e=trnd(4,1,4) > -1.6056 -0.6233 1.2819 -0.5769 > > I would like to able to get the same random numbers when restating the seed and use the t distribution. Is it possible? Am I doing something wrong? You don't say what version of MATLAB you're using, but see this page <http://www.mathworks.com/access/helpdesk/help/toolbox/stats/f4218.html#bqtuw3l> from the current Statistics Toolbox doc, and this page <http://www.mathworks.com/access/helpdesk/help/techdoc/math/brt5wsv.html> from the current core MATLAB doc. In short: 1) The expontial RNG depends only on uniform random numbers 2) The t RNG depends on both uniform and normal random numbers If you are using a version of MATLAB prior to R2008b, RAND and RAND are independent of each other. From R2008b on, they draw random values from the same underlying random number stream, but by using the deprecated syntax rand('twister',5489), you have invoked the "old" behavior. Hope this helps.
|
Pages: 1 Prev: VisualDSP link fails Next: Joystick Input |