![](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!