フィルターのクリア

generating random numbers within a certain range & spacing

13 ビュー (過去 30 日間)
Afrasiab Himaloy
Afrasiab Himaloy 2018 年 7 月 20 日
コメント済み: Afrasiab Himaloy 2018 年 7 月 23 日
if true
max=[6 7.75 8.75 9.25 9.50];
min=[5 6 7.75 8.75 9.25];
b=size(max,2);
n=20;
for i=1:b
c(i)=max(i)-min(i);
x=sort((min(i))+rand(n,1)*(c(i)), 'ascend')
y=(linspace(min(i),max(i),n))'
end
end
i want to create 20 random numbers for each c(i), but all the 20 numbers generated for each c(i) should maintain at least .025 gap among themselves. how do i do this? i cant do this with rand or linspace. anyone to help? :(

採用された回答

Fangjun Jiang
Fangjun Jiang 2018 年 7 月 20 日
randi([200 240],[20,1])/4
  11 件のコメント
Fangjun Jiang
Fangjun Jiang 2018 年 7 月 23 日
Please formulate your problem and ask a separate question. Keep in mind that this forum is for questions and answers, not for substitution of work.
Afrasiab Himaloy
Afrasiab Himaloy 2018 年 7 月 23 日
sorry sir if i am bothering a lot, but this would be helpful for this query. i will ask new questions related other problems. but this is the last one sir. because im looking for the output. sir, help me please.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by