i got a code for uniform sampling ,but still need a code for non-uniform sampling ?

2 件のコメント

Adam
Adam 2019 年 10 月 25 日
idx = [1 3 8 12 13 17];
is a non-uniform set of indices into an array of at least 17 values. Since you gave no information to help anyone understand what you want, it's as good an answer as any!
Hossam Bastawy
Hossam Bastawy 2019 年 10 月 25 日
i just wanna to simulate the process of non-uniform

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

 採用された回答

Adam Danz
Adam Danz 2019 年 10 月 25 日
編集済み: Adam Danz 2019 年 10 月 25 日

0 投票

You can draw numbers from a random sample with weighted probability by using
For example,
population = 1:20;
k = 10; %draw 10 samples from the population
w = linspace(0,1,numel(population)); % the probability of drawing each element in the population
y = randsample(population,k,true,w)
Or you could draw random numbers from a normal distribution using X = randn(n).
For example, this line below draws 20 random values from a normal distribution centered at 7 with standard deviation of 5.
x = 5 * randn(1,20) + 7

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2019 年 10 月 25 日

編集済み:

2019 年 10 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by