How to improve plotting figure when averaging within bins

1 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by