Create random numbers inside a specific plane in xy plane
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello everyone!
I am trying to generate some samples. These samples are evenly distributed in rectangular regions of R^2.
To be more specific I want to generate 400 samples in the parallelogram [2,8] x [1,2]
and 100 (different) samples in the parallelogram [ 6 , 8 ] × [ 2.5 , 5.5 ].
Finally I want to plot them in the xy plane.
I have spent hours of searching. Any help appreciated.
Thanks in advance !
댓글 수: 0
답변 (2개)
Matt J
2022년 6월 28일
I don't understand how you are specifying your parallelograms. However, one way is to use ndgrid and then apply a shear:
[X,Y]=ndgrid(1:10);
X=X(:);
Y=Y(:)+0.5*X(:);
scatter(X,Y)
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!