Picking Lognormal Random Numbers with a fixed sum?

5 visualizzazioni (ultimi 30 giorni)
Hello, i am trying to create a datasample out of the lognormal distribution, using lognormal random numbers.
Lets say i want to create 100 lognormal numbers with precalculated mean (here 17500) and varying shapes of the lognormal distribution
shapes=[0.4 0.57 0.74];
S=zeros([100 numel(shapes)]); %preallocate S Matrix
for kk=1:numel(shapes)
S = lognrnd(log(17500),shapes(kk),[kk,100]);
end
This gives me 100 lognormal random numbers in the datavalue range i want - but the problem is, for the 100 datapoints, the sum is fixed, here eg 1750000. I found this function / article
for uniformly distributed random numbers. But i didnt find any solution on normal or lognormal random numbers.
Thanks for your help and Best
Nico

Risposte (1)

Nicolas Fischer
Nicolas Fischer il 20 Ott 2019
Got it, nvm.

Community Treasure Hunt

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

Start Hunting!

Translated by