How to create a smoothed histogram and compute it's derivative magnitude in matlab

61 次查看(过去 30 天)
How can I created a smoothed histogram in matlab and I will also like to know how I can compute it's derivative magnitude.
(Assume I want to do that for a vector e.g. y = randn(1,500))

回答(2 个)

Mike Garrity
Mike Garrity 2016-3-2
编辑:Mike Garrity 2016-3-2
If you have the statistics toolbox, you might want to consider ksdensity.
x = [randn(300,1); 5+randn(300,1)];
histogram(x,'Normalization','probability')
[f,xi] = ksdensity(x);
hold on
plot(xi,f)

Richa Gupta
Richa Gupta 2016-3-2
If you have the Curve Fitting Toolbox, you can use the 'smooth' function for creating a smoothed histogram. For computing the derivative magnitude, you can use the 'diff' function. A sample code is below:
y = randn(1,500);
x = smooth(y);
z = diff(y);

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by