How to create a smoothed histogram and compute it's derivative magnitude in matlab
46 views (last 30 days)
Show older comments
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))
0 Comments
Answers (2)
Mike Garrity
on 2 Mar 2016
Edited: Mike Garrity
on 2 Mar 2016
x = [randn(300,1); 5+randn(300,1)];
histogram(x,'Normalization','probability')
[f,xi] = ksdensity(x);
hold on
plot(xi,f)
0 Comments
Richa Gupta
on 2 Mar 2016
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);
0 Comments
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!