[0,1] 上均匀分布的平均方差 MATLAB

发布于 2024-10-22 04:29:40 字数 57 浏览 7 评论 0原文

Matlab 中获取 [0,1] 上均匀分布的均值和方差的最佳方法是什么?

What is the best way in Matlab to get the mean and variance of a uniform distribution over [0,1]?.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔女人霸气范 2024-10-29 04:29:40

经验分布的均值和方差的计算方式与任何分布相同:

%# create uniform distribution
N = 1000;
dist = rand(N); %# N values, uniformly distributed between 0 and 1

%# calculate mean and variance
distributionMean = mean(dist);
distributionVariance = var(dist);

此方法提供对从中抽取样本的分布的均值和方差的估计。请注意,如果 N 较大,distributionMean 将接近 0.5,distributionVariance 将接近 1/12。如果这是您真正感兴趣的值,有用的 Matlab 命令是

web('http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)')

Mean and variance of an empirical distribution are calculated the same way for any distribution:

%# create uniform distribution
N = 1000;
dist = rand(N); %# N values, uniformly distributed between 0 and 1

%# calculate mean and variance
distributionMean = mean(dist);
distributionVariance = var(dist);

This approach provides an estimate for the mean and variance of the distribution from which your sample was drawn. Note that with larger N, distributionMean will approach 0.5, and distributionVariance will approach 1/12. If that's the values you're really interested in, the useful Matlab command is

web('http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)')
月野兔 2024-10-29 04:29:40

Uniform (0,1) 甚至 Uniform(a,b) 随机变量的均值和方差是已知公式。

对于 X~Uniform(a,b)

mean(X) = (a+b)/2

var(X) = (1/12)*((b-a)^2)

设置 a = 0b = 1 以获得所需结果。

点击此处了解更多信息。

The mean and variance of a Uniform (0,1) or even a Uniform(a,b) random variable are known formulas.

For X~Uniform(a,b),

mean(X) = (a+b)/2

var(X) = (1/12)*((b-a)^2)

Set a = 0 and b = 1 for the desired result.

Read more here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文