Which method is better for generating noise in MATLAB?
Show older comments
Hi every body, I've developed a PCA algorithm for my project. But for being realistic I want to add noise to my data. If this noise is similar to industrial noise, it will be better for me. I've found two method ('seed' and 'state') in MATLAB with randn command but I don't know which one is better for my job and which number is better for seeding? Please guide me with this issue
Answers (1)
Walter Roberson
on 10 Jun 2011
0 votes
Unless you are using an older MATLAB, you do not want either seed or state: you probably want Twister or the like. Please see RandStream and the current list of random number generators here
If you are still using a version of MATLAB that does not support even twister, then "state" is a better choice than "seed".
With regards to which number is better for seeding: if it matters to your algorithm then your algorithm needs improvement. What you do want to avoid, though, is continually reseeding with the current time: the interval between clock updates is relatively long compared to the time to generate a random number, so if you keep reseeding based upon time, you will likely end up with duplicates. There shouldn't be much need at all to reseed while you are generating numbers: if you are using "state" or later, reseeding does not increase "randomness".
1 Comment
Sean de Wolski
on 10 Jun 2011
And of the newest in ease of seeding (R2011a):
http://blogs.mathworks.com/steve/2011/06/09/matlab-r2011a/
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!