Can histogram bin edges and width be specified for the same histogram?
Afficher commentaires plus anciens
I'd like to bin data for analysis, and then repeat the analysis with differing time windows/durations. In this case, I'm analyzing neuronal spike times after binning the data like this:
edges=0:0.5:116.5;
binnedspks=histogram(sortedspikes,edges)
But there doesn't seem to be a way to specify that the data be binned in thinner bins after edges are specified, or vice versa, which would require each successive bin to skip over some of the data.
I've tried a few combinations of things like this but the edges input just seems to overwrite the width:
histogram(sortedspikes,'BinWidth',0.5,'BinEdges',edges)
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 1 Oct 2021
You can specify the bin widths
for k = 1 : 20
binWidth = k / 10; % Whatever...
edges = 0 : binWidth : 116.5;
counts = histcounts(sortedspikes, edges)
bar(edges, counts);
xlabel('Value');
ylabel('Count');
grid on;
drawnow;
pause(1); % Wait a short time so you can see the histogram.
end
1 commentaire
mackeca
le 4 Oct 2021
Catégories
En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


