EDA365电子论坛网

标题: MATLAB概率密度 [打印本页]

作者: pulbieup    时间: 2020-4-17 10:10
标题: MATLAB概率密度

[f,xi]=ksdensity(x);

plot(xi,f) ;

概率密度是plot(xi,f)曲线的高度,它乘以底边(xi)的间距(得到面积)才是概率,当xi区间越小时,fi必然会越大,甚至于单个fi超过1。曲线下面的总面积必然为1。

a;          %样本
& a+ N- W% v) ^, h! Wx=linspace(min(a),max(a),30);      %分组2 f" d8 C' [, n
yy=hist(a,x);   %频数
* l2 E4 y, G+ g- rbar(x,yy/length(a));

用hist得到的是次数,它除以总的次数得到的是频率,而后者与概率的含义相同。

histfit(data);

will plot the data as a histogram and show a smooth curve of the best fit gaussian to it.

% 下面的还没搞清楚??

[mu, sigma] = normfit(data);

pd = fitdist(data,'normal');

will give the mean (mu) and standard deviation (sigma) of that same set of data, which are used by histfit to generate the fitted curve.

0 e# B9 i' u/ I- y: q% Z7 j" p

作者: CCxiaom    时间: 2020-4-17 18:48
MATLAB概率密度




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2