1
在繪製直方圖時,我無法在X軸上的刻度線之間保持相等的距離。我指定了我想要使用的垃圾箱。直方圖上刻度線之間的距離相等
X = [ 800 ; 700 ; 200 ; 50 ; 20 ; 20 ; 10] ; Y = [1;1;1;1;1;1;1] ;
% The bins I want to use -->
BinEdges = [0 10 50 100 500 1000] ;
% Get the edge centers
EdgeLowEach= BinEdges(1:end-1); %# bins lower edge
EdgeUprEach= BinEdges(2:end); %# bins upper edge
EdgeCentr = ((EdgeLowEach + EdgeUprEach) ./ 2)'; %# bins center
[n,BinIdx] = histc(X, BinEdges) ;
Y = accumarray(BinIdx, Y, [], @sum);
h = figure; set(h,'name','Trial','numbertitle','off') ; hold on ;
bar(EdgeCentr,Y,'hist') ;
set(gca, 'XTick',BinEdges, 'XLim',[BinEdges(1) BinEdges(end)])
現在,我怎麼讓蜱蟲之間的空間0,50,100..1000一樣嗎?