matlab中normfit函数进行正太分布拟合
2016-11-21 10:01
1966 查看
一、简介
正态分布(Normal distribution)又名高斯分布(Gaussian distribution),是一个在数学、物理及工程等领域都非常重要的概率分布,在统计学的许多方面有着重大的影响力。若随机变量X服从一个数学期望为μ、标准方差为σ2的高斯分布,记为:
X∼N(μ,σ2),
则其概率密度函数为
正态分布的期望值μ决定了其位置,其标准差σ决定了分布的幅度。因其曲线呈钟形,因此人们又经常称之为钟形曲线。我们通常所说的标准正态分布是μ
= 0,σ = 1的正态分布。
二、代码
(1)pdf 和 cdf函数的说明、Probability density function(PDF) 概率密度函数;
cumulative distribution function ; CDF 是累积分布函数
(2)正态分布(normpdf normcdf)
[plain] view
plain copy
clc
clear all
close all
dataall = load('G:\zyp_thanks\metro_test\1-07\529_2.csv');
data = dataall(:,3);%指定列
[mu,sigma]=normfit(data);%estimate of the mean and standard deviation in data
[y,x]=hist(data,6);%creates a histogram bar plot of data,sorts data into the number of bins specified by nbins
%return the categorical levels correponding to each count in N
bar(x,y,'FaceColor','r','EdgeColor','w');box off
xlim([mu-3*sigma,mu+3*sigma]) % sets the axis limits in the current axes to the specified values
a2=axes;
% computes the pdf at each of the values in X using the normal distribution
% with mean and standard deviation sigma.
ezplot(@(x)normpdf(x,mu,sigma),[mu-3*sigma,mu+3*sigma])
set(a2,'box','off','yaxislocation','right','color','none')
title '频数直方图与正态分布密度函数(拟合)'
(3) quantile - quantile plot (Q-Q plot)
[plain] view
plain copy
clc
clear all
close all
dataall = load('G:\zyp_thanks\metro_test\1-07\529_2.csv');
data = dataall(:,3);%指定列
qqplot(data);
% displays a quantile-quantile plot of the sample quantiles of X versus
% theoretical from a normal distribution. if the distribution of X is
% normal,the plot will be close to linear.
相关文章推荐
- 使用 matlab 进行正太拟合
- 数据拟合---使用自定义函数进行非线性拟合 -在Origin。matlab拟合工具箱cftool
- 关于采用matlab进行指定非线性方程拟合的问题(1)
- 关于采用matlab进行指定非线性方程拟合的问题(2)
- MATLAB利用散点进行函数曲线拟合
- 数据拟合---使用自定义函数进行非线性拟合 -在Origin。matlab拟合工具箱cftool
- 【Matlab&Mathematica】对三维空间上的点进行椭圆拟合
- 关于采用matlab进行指定非线性方程拟合的问题
- 使用matlab进行空间拟合
- MATLAB正太分布函数
- Matlab做分布拟合及绘制频率分布直方图
- 数据拟合---使用自定义函数进行非线性拟合 -在Origin。matlab拟合工具箱cftool
- 使用matlab进行三角函数拟合
- R语言绘制正太分布图,并进行正太分布检验
- 用matlab对酒精浓度进行数据拟合
- 使用matlab进行多项式的拟合
- 利用MATLAB进行直线拟合的程序
- 根据一组数据拟合出最佳分布函数, arena, Matlab, R语言
- matlab进行离散点的曲线拟合
- 最小二乘法(c语言实现线性,matlab进行拟合)及相关系数的求解