Results 1 to 2 of 2

Math Help - need a matlab function

  1. #1
    Member
    Joined
    Aug 2010
    Posts
    77

    need a matlab function

    How would I choose whether a constant is + or - with equal probability in matlab?
    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 FGT12 View Post
    How would I choose whether a constant is + or - with equal probability in matlab?
    x=abs(x)*( 1-2*(rand(1,1)<0.5) )
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Matlab function
    Posted in the Math Software Forum
    Replies: 2
    Last Post: April 17th 2010, 09:11 PM
  2. Please help with MATLAB function
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 16th 2010, 05:21 AM
  3. is there any function in MATLAB?
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 4th 2010, 02:57 AM
  4. MATLAB function help
    Posted in the Math Software Forum
    Replies: 1
    Last Post: March 23rd 2010, 02:53 PM
  5. Matlab while function
    Posted in the Math Software Forum
    Replies: 1
    Last Post: May 10th 2009, 12:46 AM

Search Tags


/mathhelpforum @mathhelpforum