How to improve plotting figure when averaging within bins

1 visualizzazione (ultimi 30 giorni)
I am trying to take the mean of bins that I assign and have done so in the following way:
binEdge = linspace(min(a), max(a), 5);
[n,bin] = histc(a, binEdge);
A = accumarray(bin(:),P1,[],@mean)
figure
plot(binEdge, A);
xticks([0, 0.02, 0.04, 0.06, 0.08, 0.1);
However the plot I am getting doesn't show a single value for each bin i.e. like a stepwise function would look. It's all linear and I'm wondering how to change that. Thanks

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by