EDA365电子论坛网

标题: MATLAB实现频数直方图——hist的使用 [打印本页]

作者: uqHZau    时间: 2020-8-18 14:56
标题: MATLAB实现频数直方图——hist的使用
本帖最后由 uqHZau 于 2020-8-18 15:33 编辑
4 t9 t5 v  _& J
% ]/ ~* A6 ^/ W- ]
1.N = hist(Y)
(将向量Y的元素平均分到十个等间隔的容器中,并且返回每个容器的元素个数。如果Y是一个矩阵,hist指令逐列元素操作。Y为向量的情形见例1和2,为矩阵的情形见例3.)
>> Y = [1:10];+ {4 {3 E2 R( Q( ?# @9 t% ]! ^' _
>> hist(Y)
例2.执行指令
得到
Y最大为11,最小为1,故而将区间[1,11]均分为10分,分别为[1, 2], (2,3], (3,4], (4,5], (5,6], (6,7], (7,8], (8,9], (9,10], (10,11].3 |  z% x9 q% u7 c1 ?
执行指令:
注意,Y为矩阵:
Y有三列元素,逐列元素产生对应的直方图。得到
观察此图和矩阵Y,由于Y的元素最大为1,最小为6,故而将区间[1,6]以0.5的间隔划分为10个等长的子区间作为10个容器去容纳数据。图中有三种颜色的方条:蓝色,绿色和红色,分别对应Y中的第1,2,3列元素。如第一列元素为1和3,故而区间[1,1.5]和(2.5,3]中有蓝色方条。
+ n- Y: K, g2 O9 L
where M is a scalar, uses M bins.(M是一个标量,表明使用M个箱子)
>> Y = [1, 1, 1.3, 2.6, 3, 3.4, 5, 5.9, 6, 6,1, 7, 7,2];
得到
3.N = hist(Y,X)
where X is a vector, returns the distribution of Y among bins with centers specified by X.(X是向量,以X中的元素为区间中心可获得一系列区间,执行命令可获得Y在这些区间中的分布情况。) The first bin includes data between -inf and the first center and the last bin includes data between the last bin and inf. Note: Use HISTC if it is more natural to specify bin edges instead.
+ M9 L9 {) d1 Y# ^9 w$ ~8 \

作者: NNNei256    时间: 2020-8-18 15:31
MATLAB实现频数直方图——hist的使用




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