How to get the probability values from a histogram matlab

时间:2015-06-25 18:41:06

标签: matlab math histogram probability

This a math/matlab question I have a data set of angles ranging from -180 to 180 I then make a histogram of the data set using the code histogram(angles) I want to use the probabilities from the histogram for another plot for the equation ln(probabilty of angle) = constant(angle) + constant The problem is that I don't know how to get the values for probabilities for the angles from -180 to 180 from the histogram. I've read that I need to normalize my histogram but from there I am not sure what to do Thanks

1 个答案:

答案 0 :(得分:0)

函数hist()将使用其第三个参数为您规范化:

x = rand(1000, 1)*360-180;
[probas, angles] = hist(x, -180:10:180, 1.0);
bar(angles, probas);

您可能希望合并bin -180和+180的值 现在anglesprobas可用于其他图表。