在Matlab中绘制样本的正态分布图

在Matlab中绘制样本的正态分布图

本文介绍了在Matlab中绘制样本的正态分布图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有100个采样数字,我需要在matlab中绘制它们的正态分布曲线.

I have 100 sampled numbers, and I need to draw the normal distribution curve of them in matlab.

可以很容易地计算出这些采样数据的平均值和标准偏差,但是是否有绘制正态分布的函数?

The mean and standard deviation of these sampled data can be calculated easily, but is there any function that plots the normal distribution?

推荐答案

如果您有权访问统计信息工具箱,则函数histfit会执行我认为您需要的操作:

If you have access to Statistics Toolbox, the function histfit does what I think you need:

>> x = randn(10000,1);
>> histfit(x)

就像使用hist命令一样,您还可以指定垃圾箱的数量,还可以指定使用哪种分布(默认情况下是正态分布).

Just like with the hist command, you can also specify the number of bins, and you can also specify which distribution is used (by default, it's a normal distribution).

如果没有统计工具箱,则可以结合使用@Gunther和@learnvst的答案来重现类似的效果.

If you don't have Statistics Toolbox, you can reproduce a similar effect using a combination of the answers from @Gunther and @learnvst.

这篇关于在Matlab中绘制样本的正态分布图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 22:39