Results 1 to 4 of 4

Math Help - MATLAB: Random numbers

  1. #1
    Newbie
    Joined
    Jan 2009
    Posts
    5

    MATLAB: Random numbers

    I am trying to generate a sequence of 100 random numbers from N (0, 1) using the matlab command randn. I am completely new to matlab so I had a look at the documentation, however, I am still unclear as to how exactly to use the randn command. I understand that one of the parameters is the stream from which the random numbers are obtained and the other parameter is the matrix size.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by agentsmith270288 View Post
    I am trying to generate a sequence of 100 random numbers from N (0, 1) using the matlab command randn. I am completely new to matlab so I had a look at the documentation, however, I am still unclear as to how exactly to use the randn command. I understand that one of the parameters is the stream from which the random numbers are obtained and the other parameter is the matrix size.
    Basic operation should work, try

    N=randn([1,100])

    (iirc this will use a state set from the system clock to start the stream)

    .
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2009
    Posts
    5

    MATLAB: random numbers

    Thanks, I was doing something similar to this but wasn't sure if it was right. However, what if I wanted to compute random numbers from N(5,25) or any other distribution, how would that be done?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by agentsmith270288 View Post
    Thanks, I was doing something similar to this but wasn't sure if it was right. However, what if I wanted to compute random numbers from N(5,25) or any other distribution, how would that be done?
    rand([1.100])*5+5

    or rather:

    rand([1.100])*SD+mean

    .
    Last edited by Constatine11; January 28th 2009 at 12:23 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: August 29th 2011, 02:18 AM
  2. Replies: 1
    Last Post: June 3rd 2010, 09:39 AM
  3. Matlab - Random Number between 1 .. n
    Posted in the Math Software Forum
    Replies: 2
    Last Post: March 16th 2010, 04:55 PM
  4. Replies: 1
    Last Post: April 7th 2009, 08:52 AM
  5. MATLAB - Random Number Generation
    Posted in the Math Software Forum
    Replies: 4
    Last Post: February 18th 2009, 06:03 AM

Search Tags


/mathhelpforum @mathhelpforum