File Exchange

image thumbnail

Uniformly distributed weights that sum up to 1

version 1.0.0.0 (998 Bytes) by Yavor Kamer
Generates N uniformly distributed weights that sum up to 1

1 Download

Updated 18 Nov 2016

View License

A common way to do this is to generate a uniformly random vector with rand(1,N) and then divide it by its sum. But, as you can see in the figure and the script, this creates biased distributions that undersample high values. The randUniWght function produces better sampling.
You can find more on the topic here
http://stats.stackexchange.com/questions/14059/generate-uniformly-distributed-weights-that-sum-to-unity

Cite As

Yavor Kamer (2020). Uniformly distributed weights that sum up to 1 (https://www.mathworks.com/matlabcentral/fileexchange/60284-uniformly-distributed-weights-that-sum-up-to-1), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux