如何使用分箱法来识别入射点属于哪个分箱?

How to use binning method for identifying the incoming point belongs to which bin?

我有一些小疑问。我有两个数据集。例如,在一个数据集中,我进行了分箱并计算了平均值和标准值以及组分箱。现在我有第二个具有相同参数的数据集,比如 X。我想使用 matlab 识别这个 X 数据集属于我以前的数据集的哪个 bin 组。

能否举例说明如何识别传入数据点属于哪个 bin 组...??

我使用了 matlab 中提供的以下分箱:

  binEdges = linspace(botEdge, topEdge, numBins+1);
  [h,whichBin] = histc(x, binEdges);

好吧...您已经有了垃圾箱边缘。特定边缘内的任何东西都在那个箱子里。

如果您知道数据在您定义的范围内,那么对于每个新数据

newdatabin=find(newdata>binedges,1,'last'); %this is the bin number where the new data goes in

h(newdatabin)=h(newdatabin)+1; %add one!

如果您的 MATLAB 版本足够新,也可以考虑使用 histcounts