matlab利用概率密度求概率。

新手,请教老师答疑!!!matlab中的ksdensity函数可以估计概率密度函数,那么可以该函数求的概率密度求某一区间范围的概率值吗?如果想求概率值应该怎么做?(我有很多采集的样本值想求概率)

 采纳的回答

jatecos
jatecos 2022-11-21

0 个投票

核密度估计本身是有表达式的,它的表达式取决于你用什么核函数
当然,你只是计算定积分,跟有没有表达式没有关系,只要有数值即可。举个例子:
data = normrnd(1,2,100000,1);
pdfEst = @(x)ksdensity(data,x);
mu = integral(@(x) x.*pdfEst (x),-Inf, Inf)
Var = integral(@(x) (x-mu).^2.*pdfEst (x),-Inf, Inf)

更多回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!