matlab - 如何在 Matlab 中将曲线拟合到直方图?
问题描述
我探索了关于上述主题的类似问题,但他们无法帮助我找到以下直方图的良好曲线。例如,在以下代码的输出中,曲线的峰值很高(它具有高峰度)。如何解决这个问题呢?
代码:
SumR = [1.02957968211466e+23,1.12316700832322e+16,1.01205904405943e+24,1.23183231736978e+22,1.71254955156886e+18,0,2.78888971554146e+16,1.06495767772703e+21,1.02761772773492e+24,2.56040885583339e+19,3.04201226469320e+21,1.12113264824989e+20,5.23573831147063e+18,1.95497792957160e+19,1.36150887360868e+19,4.41352571341253e+22];
h = histogram(SumR, 'FaceColor','g'); % SumR is a vector with dim 1x16.
numbins = h.NumBins; % In this example is 3.
...' figure out how to scale the pdf, to the area of the histogram.
[bincounts,binpos] = hist(SumR, numbins);
binwidth = binpos(2) - binpos(1);
histarea = binwidth*sum(bincounts);
...' kernel estimator.
[f,x,u] = ksdensity(SumR);
line(x, f*histarea, 'Color', 'g', 'LineWidth',2);
输出:
并且,考虑下面的图像,曲线的哪个峰值应该像红色曲线。
解决方案
推荐阅读
- testng-dataprovider - 如何在覆盖构造函数中使用 2 个具有 2 个数据类型和 1 个工厂的 DataProviders
- api - 创建工单时出现“优先级:不能为空”错误
- oauth - Google 是否会等待无限的 refresh_token 来调用云合作伙伴?
- javascript - jQuery拆分获取最后2位
- android - android kotlin 中的数据绑定在同一个视图中
- amazon-web-services - 是否可以/推荐在 AWS CodeBuild 中使用“sam build”?
- php - 请求在实时主机上不起作用,但在本地工作
- java - 多种类型的相同接口
- git - git添加节点模块没有响应
- android - NavigationView 上的 OnClickListener 不起作用