要将 bin 中心转换为 bin 边界,请计算 centers 中各连续值之间的中点。
d = diff(centers)/2;
edges = [centers(1)-d(1), centers(1:end-1)+d, centers(end)+d(end)];
要将 bin 边界转换为bin 中心
bincenters = binedges(1:end-1)+diff(binedges)/2;
要将 bin 中心转换为 bin 边界,请计算 centers 中各连续值之间的中点。
d = diff(centers)/2;
edges = [centers(1)-d(1), centers(1:end-1)+d, centers(end)+d(end)];
要将 bin 边界转换为bin 中心
bincenters = binedges(1:end-1)+diff(binedges)/2;