我想要一个MATLAB程序,在给定以下输入的情况下,假设高斯分布生成n
个随机数:
答案 0 :(得分:5)
高斯分布的另一个词是正态分布。多维有时也称为多变量。 因此,请参阅:Multivariate Normal Distribution in Matlab。
答案 1 :(得分:1)
如果您无权访问统计工具箱,则可以使用(x,y)
randn
对
%# create an array of 100 pairs of normally distributed
%# coordinates with mu=0 and sigma=1
xy = randn(100,2);
%# transform the data such that means equal mu
%# and standard deviations equal sigma (no cross-correlation)
mu = [3,25]; %# means for x, y
sigma = [9,1]; % standard deviations for x,y
xy = bsxfun(@times,xy,sigma); %# fix standard deviation
xy = bsxfun(@plus,xy,mu); %# fix means