필터 지우기
필터 지우기

Random path coordinates in 2D within a unit square

조회 수: 5 (최근 30일)
KalMandy
KalMandy 2017년 5월 4일
댓글: KalMandy 2017년 5월 5일
Hi all, I want to generate a random path within a unit square and get the x,y coordinates of 1000 points on it. Can you suggest a way to do it?
start point and the end point should lie diagonally on the opposite corners. For example, if the starting point is (0,0), end point should be (1,1). and if the starting point is (0,1), end point should be (1,0)
I would like to generate random path like this and obtain the coordinates along the path. Please see the attached figure.

답변 (2개)

James Tursa
James Tursa 2017년 5월 4일
편집: James Tursa 2017년 5월 4일
Any restrictions on the path? E.g., would 1000 random points suffice:
mypath = rand(1000,2); % <-- each row is an (x,y) point in a unit square
  댓글 수: 9
KalMandy
KalMandy 2017년 5월 5일
@David I want to have all of the path inside the unit square.
KalMandy
KalMandy 2017년 5월 5일
@John yes you are right.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2017년 5월 5일
편집: Image Analyst 2017년 5월 5일
See my attached random walk programs and adapt as needed.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by