Distribution Fit with Hole in Histogram: Calculate mean and std
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a question concerning the Distribution Fitter Toolbox:
I have a measured data vector and I want to calculate the mean and std. But unfortunately because of measurement noises etc. the histogram has a hole (x-value [3 3.5], see image).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166907/image.png)
With the Distrubution Fitter I like to "ignore" the non-existent data and want to calculate the mean and the std with simulated values between [3, 3.5].
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166908/image.png)
But the ruesults of the Toolbox are the same as for the mean and std function. With the Distribution Fitter Toolbox (or otherwise) is it possible to calculate values of the hist between [3, 3.5] and then calculate the mean and the std including the non-existent values?
Thank you for your help.
1 个评论
John D'Errico
2017-8-31
编辑:John D'Errico
2017-8-31
Please don't add an answer just to gain attention to your question. A comment is a comment. Use that. It will make your question active just as a new answer will. But by adding an answer, that actually prevents your question from being seen by many people, due to filters that filter out questions that already have an answer.
回答(1 个)
Jim Joy
2017-8-31
Hi Konstantin,
One thing that you might try is replacing all of your data in the interval where the hole exists by nan before fitting your distribution. The distribution fitter will then ignore this interval. To do this, use the code snippet below, where 'x' is a vector containing the raw measurements:
toRmv = (x >= 3.0) & (x < 3.5);
x(toRmv) = nan;
newFit = fitdist(x,'Normal');
With regard to the value of the mean and standard deviation, the estimate for the value obtained in your fit will probably be pretty close to the value you want. Remember that the Normal Distribution is characterized completely by its mean and standard deviation. That means that the value you obtain in the fit will more likely than not agree with the value that you observe in the experiment.
I hope this helps.
-Jim
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!