答案 0 :(得分:2)
fileID = fopen('q65.txt','r');
formatSpec = '%f';
file = fscanf(fileID,formatSpec);
h = histogram(file,50);
%Find index of maximum
[~, index]= max(h.Values);
delta = h.BinLimits(2)-h.BinLimits(1);
% find the range for a single bin
slot = delta./h.NumBins;
%location = minimum y + (index of maxmium)*slot
lb = h.BinLimits(1) + (index-1)*slot;
ub = h.BinLimits(1) + (index)*slot;
location = [lb, ub]
位置是一个范围,而不是固定的数字
fileID = fopen('q65.txt','r');
formatSpec = '%f';
file = fscanf(fileID,formatSpec);
h = histogram(file,50);
%Find index of maximum
[~, index]= max(h.Values);
lb = h.BinEdges(index);
ub = h.BinEdges(index+1);
location = [lb, ub]
答案 1 :(得分:0)
[Y,X] = max(h);
您尝试过吗?