繁体   English   中英

建议的直方图函数中的Bin中心-Matlab

[英]Bin centers from recommended histogram function - Matlab

Matlab现在建议使用直方图代替hist,但是没有像以前的函数那样显示一种查找bin中心的明显方法。

我当前的代码可以与hist函数正常工作:

数字

[counts171,position171] = hist(image171_reshaped,200);

图(position171,日志(counts171));

我如何能够转换这段代码,以结合推荐的功能(例如“直方图”或“ histcounts”)代替“ hist”,同时仍然获得bin中心?

histcounts返回边缘而不是bin中心,并且bin中心是边缘的连续元素之间的中点。 因此,使用diff函数可以得到bin中心:

[counts171,edges171] = histcounts(image171_reshaped,200);

position171 = edges171(1:end-1) + diff(edges171) / 2;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM