Can histogram bin edges and width be specified for the same histogram?
Mostrar comentarios más antiguos
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)
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 1 de Oct. de 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 comentario
mackeca
el 4 de Oct. de 2021
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


