Results 1 to 2 of 2

Math Help - matlab help should be easy

  1. #1
    Senior Member
    Joined
    Oct 2008
    Posts
    393

    matlab help should be easy

    i have to generate a number between -1 and 1 and it being random

    i.e

    -1 < x < 1
    then rand (x)

    how do i do this on matlab?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Aug 2008
    From
    Paris, France
    Posts
    1,174
    Quote Originally Posted by adam_leeds View Post
    i have to generate a number between -1 and 1 and it being random

    i.e

    -1 < x < 1
    then rand (x)

    how do i do this on matlab?
    rand() returns a random number between 0 and 1 (with uniform distribution), hence 2*rand()-1 will return a random number between -1 and 1 (uniformly distributed)
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: February 9th 2013, 08:59 PM
  2. Easy Easy Trig help
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: November 27th 2009, 11:09 PM
  3. Seemingly easy question... too easy.
    Posted in the Pre-Calculus Forum
    Replies: 3
    Last Post: August 23rd 2009, 09:36 PM
  4. easy, easy question
    Posted in the Discrete Math Forum
    Replies: 3
    Last Post: July 14th 2009, 07:38 AM
  5. Easy probability that is not so easy for me!
    Posted in the Statistics Forum
    Replies: 1
    Last Post: May 9th 2009, 07:03 AM

Search Tags


/mathhelpforum @mathhelpforum