MATLAB: How to plot an histogram enveloppe

enveloppehistogramMATLAB and Simulink Student Suite

Hello !
I have some datas and I ploted them on an histogram :
But I would like to have only the "enveloppe" like this :
Do yo know how to proceed to do that ?
Many thanks in advance

Best Answer

Try this
x = exprnd(1, [1, 10000]);
fig = figure();
ax = axes();
hold on;
h = histogram(x, 100);
[counts, edges] = histcounts(x, 100);
locs = movmean(edges, 2, 'Endpoints', 'discard');
plot(locs, counts, 'LineWidth', 3);