how do I fix the seed in the trnd function
    3 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Dear all,
I use matlab 2012 and I want to generate values from a student t distribution. I use the function "trnd". HOw can I fix the see in this function
thanks
0 Kommentare
Akzeptierte Antwort
  Wayne King
    
      
 am 10 Nov. 2012
        I'm not sure why you want to do that since you can use rng() without using the legacy mode by removing those calls and using rng() instead.
But if you are insisting, then you have to do something like:
rng(sd,'v5uniform')
for calls to rand()
and
rng(sd,'v5normal')
for randn(), where sd is the seed.
You should enter
>>help rng
at the command line and read the documentation linked from
Updating Your Random Number Generator Syntax.
This is all explained there in detail.
2 Kommentare
  Wayne King
    
      
 am 10 Nov. 2012
				I get the following
rand('state',30)
x = rand(10,1)
%%%now using rng
rng(30,'v5uniform')
y = rand(10,1)
Identical
Weitere Antworten (2)
  Wayne King
    
      
 am 10 Nov. 2012
        Don't do that. Don't call rand('state', ) before using rng.
rng seeds the random number generator for you. Remove that from and your code and just use rng() to do the work.
Siehe auch
Kategorien
				Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!