Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab Help

  1. Nov 12, 2007 #1
    Okay... I am using the randn function for a sequence of normally distributed numbers.
    I am writing a program whereby I need to use this randn to give me random x and y values whose position r is less than 1

    i.e. that is to say that all points fall within a 2 x 2 square centred at (0, 0).
    And I MUST use randn

    Can anyone help me achieve this.

  2. jcsd
  3. Nov 12, 2007 #2
    Do you need the points to have any particular distribution (normal, uniform, etc.)? You could just discard any generated points that fall outside the 2 x 2 square, but then the points will not have a normal distribution.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Matlab Help Date
MATLAB MATLab: Not enough inputs for nlinfit Nov 16, 2017
MATLAB Help needed to fix a matlab code Nov 8, 2017
New to Matlab, help with vectors Feb 20, 2016
Need help with integral Dec 23, 2015
MATLAB 2D diffusion equation, need help for matlab code. Nov 7, 2015