Thursday, August 11, 2011
How can I do random transposition in Matlab?
I have a project where part of it requires me to take a function, f, and create another function f* from f by randomly switching two of the values f igns to two independent variables. I have a vector that stores the f values, but when I use the command: rand1 = round(rand)*4 + 1 to get random integers from 1 to 5. The only values I get are 1 and 5. I actually made a loop that would only stop when rand1 equaled 2 and after thousands of iterations I had to stop it myself. rand is supposed to generate a number between 0 and 1 so I don't understand why it's not working.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment