Results 1 to 2 of 2

Math Help - HELP with MATLAB: Compute distribution of 1000 random numbers

  1. #1
    Newbie
    Joined
    Jun 2010
    Posts
    3

    HELP with MATLAB: Compute distribution of 1000 random numbers

    Hello,

    I have to write a MATLAB program that:

    A. Generates 1000 random digits (0-9).

    B. Computes the distribution of these 1000 numbers.
    Print out the dist., along with the mean and variance

    I think I have the answer for A, which is this:

    r = floor(10.*rand(1000,1));

    But I can't seem to figure out B.

    Can anyone help? Thanks in advance, any help is greatly appreciated.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by mchliakh View Post
    Hello,

    I have to write a MATLAB program that:

    A. Generates 1000 random digits (0-9).

    B. Computes the distribution of these 1000 numbers.
    Print out the dist., along with the mean and variance

    I think I have the answer for A, which is this:

    r = floor(10.*rand(1000,1));

    But I can't seem to figure out B.

    Can anyone help? Thanks in advance, any help is greatly appreciated.
    You need to count the number of 0s, 1s, 2s, ..., 9s. There are many ways of doing this but:

    >sum(r==0)/1000

    will return the proportion of 0s in the sample.

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Compute f'(x) and finding critical numbers
    Posted in the Calculus Forum
    Replies: 2
    Last Post: November 19th 2010, 08:53 AM
  2. Replies: 3
    Last Post: May 11th 2010, 01:22 PM
  3. Replies: 1
    Last Post: April 7th 2009, 09:52 AM
  4. MATLAB: Random numbers
    Posted in the Math Software Forum
    Replies: 3
    Last Post: January 28th 2009, 12:10 PM
  5. 1 coin tossed 1000 times vs 1000 coins
    Posted in the Advanced Statistics Forum
    Replies: 14
    Last Post: December 20th 2007, 07:55 PM

Search Tags


/mathhelpforum @mathhelpforum