![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173159/image.png)
How to create a smoothed histogram and compute it's derivative magnitude in matlab
37 ビュー (過去 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))
0 件のコメント
回答 (2 件)
Mike Garrity
2016 年 3 月 2 日
編集済み: Mike Garrity
2016 年 3 月 2 日
x = [randn(300,1); 5+randn(300,1)];
histogram(x,'Normalization','probability')
[f,xi] = ksdensity(x);
hold on
plot(xi,f)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173159/image.png)
0 件のコメント
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);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!