Rewrite the script and fit a 'kernel' distribution plot into a histogram
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
This is my script. I am trying to it a 'kernel' distribution plot into an existing histogram. So, how can i do that and which line should i add to the script? Or how to re-write the script? P.S. the 'yG' is the data from excel. Do i need to use the 'stacked' function in the bar(b,[cntG'], 'stacked') if i only got one group of data. I think i have made my script too complicated.....
% yG = total
load yG
% specify number of bins and edges of those bins; this example evenly spaces bins
NumBins = 100;
BinEdges = linspace(0,35,70);
% use histcounts and specify your bins
cntG = histcounts(yG,'BinEdges',BinEdges);
% plot
figure(1); cla; hold on;
% convert bin edges into bin centers
b = BinEdges(1:end-1)+diff(BinEdges)/2
% use bar
bar(b,[cntG'],'stacked')
% Labels
xlabel('Length(mm)')
ylabel('Count')
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!