如何找到直方图中最高峰的x值?
How to find x-value of highest peak in histogram?
如何将直方图中最高峰的x值保存到变量中?谢谢
[Y,X] = max(h);
你试过吗?
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]
如何将直方图中最高峰的x值保存到变量中?谢谢
[Y,X] = max(h);
你试过吗?
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]