Need help finding the std of half a normal distribution
3 次查看(过去 30 天)
显示 更早的评论
Hi! I have trouble getting the std of the left side of my plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/879740/image.png)
This is the result of plotting my row vector of values.
First thing I tried was getting rid of the values after the peak, mirroring the plot, and using histfit with the half normal distribution fit option to get the std. This resulted in an std far below 1:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/879745/image.png)
Using this:
pd = fitdist(equation(:),'hn');
Gave me a sigma of 0.0021. This is obviously not right.
Then I tried using horzcat() to get a normal distribution from the first plot and the mirror together:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/879750/image.png)
I used the std() function, histfit() with 'normal', and I used a formula for the weighted std.
Nothing comes close to the value that it should be, around 40.
Help would be appreciated!!
0 个评论
回答(1 个)
Benjamin Thompson
2022-1-31
The std function is intended to calculate the standard deviation of a sample of data. It is not intended to estimate parameters of a curve. If your function is actually a probability density function and you are looking to fit a half gaussian PDF to part of that PDF, you might want to use the curve fit tool to estimate the best parameters.
The general Gaussian curve is described at Wikipedia in this article:
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!