【问题标题】:Gaussian distribution [closed]高斯分布
【发布时间】:2012-09-12 11:27:00
【问题描述】:

我想要一个 MATLAB 程序来生成 n 随机数,假设为高斯分布,给定以下输入:

  • 2 表示(用于 x 和 y 轴)
  • 标准差
  • 方差(协方差矩阵 = 标准差 x 单位矩阵)

【问题讨论】:

  • 你有什么问题?这听起来像是要求我们为您做作业。

标签: matlab random plot gaussian


【解决方案1】:

高斯分布的另一种说法是正态分布。多维有时也称为多变量。 因此请参阅:Multivariate Normal Distribution in Matlab

【讨论】:

  • +1 用于解释术语。
【解决方案2】:

如果您无法访问统计工具箱,您可以使用 randn 创建正态分布数据对 (x,y)

%# 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-07
    • 2010-11-09
    • 2015-10-16
    • 2017-11-24
    • 2019-07-15
    • 1970-01-01
    相关资源
    最近更新 更多