How to improve plotting figure when averaging within bins

조회 수: 3 (최근 30일)
laura9510
laura9510 2017년 2월 9일
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에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by