Matlab Help

  • MATLAB
  • Thread starter strokebow
  • Start date
  • #1
123
0

Main Question or Discussion Point

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.

thanks
 

Answers and Replies

  • #2
230
0
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.
 

Related Threads on Matlab Help

  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
3
Views
4K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
6
Views
7K
  • Last Post
Replies
9
Views
3K
  • Last Post
Replies
6
Views
2K
Top