how to generate random numbers in space

2 ビュー (過去 30 日間)
Hassan
Hassan 2013 年 10 月 16 日
コメント済み: Jan 2013 年 10 月 17 日
Dear All, If I have points (x,y) In space such as:
x=[ 5 5 5 13 12 13 28 21 25 31 39 39 45 41 49 ];
y=[ 9 25 48 4 19 39 37 45 50 9 2 16 22 30 31 ];
what is the best way to generate random matrix in this space
[(x11 ,y11), (x12 ,y12), (x13 ,y13),;
(x21 ,y21), (x22 ,y22), (x23 ,y23),;
(x31 ,y31), (x32 ,y32), (x33 ,y33),];
  1 件のコメント
Jan
Jan 2013 年 10 月 17 日
The result does not have valid Matlab syntax. Therefore we cannot guess reliably, what this should mean. Please edit your question to clarify it.

サインインしてコメントする。

回答 (2 件)

the cyclist
the cyclist 2013 年 10 月 16 日
I am not 100% sure I understand what you mean, but this may help you get started:
x=[ 5 5 5 13 12 13 28 21 25 31 39 39 45 41 49 ];
y=[ 9 25 48 4 19 39 37 45 50 9 2 16 22 30 31 ];
N = numel(x);
idx = randi(N,3);
Mx = x(idx);
My = y(idx);

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 16 日
I don't know why you are calling (x,y) point in space?
n=50;
M=cell(3,4)
out=cellfun(@(x) randi(n,1,2),M,'un',0)
celldisp(out)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by