在 Matlab 中创建双峰分布以在列向量中求和
Creating a bimodal distribution to equal sum in column vector in Matlab
我正在尝试在 Matlab 中生成一个列向量 (nx1),其值具有双峰分布。我希望列向量中的所有值总和为一个指定值,并且能够指定分布中的最小值和最大值。
谢谢!
双峰分布是有两个峰的分布,f.e两个正态分布的叠加:
n = 100;
X = 1:n;
PDF = normpdf(X, 30, 5) + 5*normpdf(X, 60, 10); % take the combination of two normal distrubtions
PDF = PDF/sum(PDF); % normalise it, i.e. sum equals to one.
figure
plot(X, PDF); % plot the result
我正在尝试在 Matlab 中生成一个列向量 (nx1),其值具有双峰分布。我希望列向量中的所有值总和为一个指定值,并且能够指定分布中的最小值和最大值。
谢谢!
双峰分布是有两个峰的分布,f.e两个正态分布的叠加:
n = 100;
X = 1:n;
PDF = normpdf(X, 30, 5) + 5*normpdf(X, 60, 10); % take the combination of two normal distrubtions
PDF = PDF/sum(PDF); % normalise it, i.e. sum equals to one.
figure
plot(X, PDF); % plot the result