1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Difference rand and randn command matlab

  1. Nov 14, 2013 #1
    i am confused between when to use rand and randn . can someone explain to me please?
     
  2. jcsd
  3. Nov 15, 2013 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Both are pseudo-random number generators.
    http://www.mathworks.com/help/matlab/random-number-generation.html

    type "help rand" and "help randn" for a description.

    Code (Text):
    rand()
    Return a matrix with random elements uniformly distributed
    on the interval (0, 1).  The arguments are handled the same
    as the arguments for `eye'.

    randn()
    Return a matrix with normally distributed pseudo-random
    elements having zero mean and variance one.  The arguments
    are handled the same as the arguments for `rand'.
    You should be able to see the result by filling a vector with them and plotting.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Difference rand and randn command matlab
  1. Matlab command while (Replies: 4)

Loading...