Creating Random Vector with Set intervals

15 ビュー (過去 30 日間)
Chelles Rees
Chelles Rees 2019 年 11 月 9 日
編集済み: Chelles Rees 2019 年 11 月 9 日
I cant seem to ceate a random vector from 1-10k then 1-20k then 1-30k consectuively until 100k logging different values.
Here is the code I have so far,
inc=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000];
for l=1:length(inc) %creating a loop to go through the 10 values of inc
vec1 = randi(1,inc(l)); %geenrating random vector from 1-respective value of inc
any help would be appreciated

回答 (1 件)

David Hill
David Hill 2019 年 11 月 9 日
How long do you want the vectors to be? Why not make a matrix where each row has the vectors?
M=zeros(10);
for i=1:10
M(i,:)=randi(10000*i,[1,10]);
end
  1 件のコメント
Chelles Rees
Chelles Rees 2019 年 11 月 9 日
編集済み: Chelles Rees 2019 年 11 月 9 日
I need the vecors to be 10k, 20k, 30k long consectuviely until 100k

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

カテゴリ

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