Random matrices with constraint

How to create random matrix with n=100, uniform distribution and with following constraints: 0<aij<1 and sum of columns less than 1. I have codes but they work only for small matricies.

1 件のコメント

DGM
DGM 2021 年 10 月 12 日
If I get this right, you have a 100x100 array of uniformly distributed random numbers between 0,1 ... but the column sums are less than 1.
How do you have a uniform distribution on the interval [0 1] such that the mean is 1/100?

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

回答 (2 件)

Walter Roberson
Walter Roberson 2021 年 10 月 12 日

1 投票

t = rand(n, n);
nt = t./sum(t,1);
output = nt.*rand(1,n);
nt is normalized so that the sum of each column is 1. The step after that is to scale to a random sum less than 1. You might want to use a different distribution in that scaling.
Tato Khundadze
Tato Khundadze 2021 年 10 月 12 日

0 投票

Thanks, you are right. Uniform distribution will not work without scaling. I should consider the maybe Poisson distribution, which would assign lower marginal probabilities to the numbers which are closer to 1.

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

製品

タグ

質問済み:

2021 年 10 月 12 日

回答済み:

2021 年 10 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by