MATLAB: How to plot a histogram as a curve

histogramMATLABplot

I have a histogram that I want to plot just as a simple line plot. I have tried:
h = histogram(speed,'Normalization','probability')
plot(h)
But then I got an error message: Not enough input arguments.
Does anyone know how I can do it? Many thanks!

Best Answer

[N,edges] = histcounts(X, 'Normalization','pdf');
edges = edges(2:end) - (edges(2)-edges(1))/2;
plot(edges, N);
Personally I just do a simple calculation from histcounts