[英]In MATLAB (cumulative distribution function), how can I find the corresponding data point (Y) for any chosen cumulative probability?
In a CDF (using MATLAB) how can I find the corresponding data value (X) for any chosen cumulative distribution (Y)? 在CDF(使用MATLAB)中,如何找到任何选定累积分布(Y)的相应数据值(X)? Please refer to the pasted code (I would post an image but I need a "10 reputation").
请参考粘贴的代码(我会发布图片,但我需要“10声誉”)。 Instead of "eye-balling" the plot, how can I find the data point (X) that corresponds to the cumulative probability value of 0.2 or even 0.5, etc.?
如何找到与0.2或甚至0.5等累积概率值相对应的数据点(X),而不是对图进行“瞄准”。 Please advise.
请指教。 Thank you.
谢谢。
X = randn(1,500);
u = mean(X);
s = std(X);
pd = makedist('Normal','mu',u,'sigma',s);
x = min(X):.1:max(X);
cdf_normal = cdf(pd,x);
plot(x,cdf_normal,'LineWidth',4)
I don't know what is in makedist
, but Matlab has a powerful tool called find
which will seek out what you need. 我不知道什么是
makedist
,但Matlab有一个强大的工具叫做find
,它会找出你需要的东西。
In your case, if I had to guess, you can do 在你的情况下,如果我不得不猜测,你可以做到
x(find(cdf_normal >= 0.2,1))
to get your desired data point x. 获得所需的数据点x。
Basically it searches cdf_normal for the first occurrence of the correct statement, returns the index, then displays the value if x which corresponds to that index. 基本上,它会在第一次出现正确语句时搜索cdf_normal,返回索引,然后显示与该索引对应的x的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.