matlab利用概率密度求概率。

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

 Accepted Answer

jatecos
jatecos on 21 Nov 2022

0 votes

核密度估计本身是有表达式的,它的表达式取决于你用什么核函数
当然,你只是计算定积分,跟有没有表达式没有关系,只要有数值即可。举个例子:
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)

More Answers (0)

Tags

Asked:

on 21 Nov 2022

Answered:

on 21 Nov 2022

Community Treasure Hunt

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

Start Hunting!