请问如何根据积分值求积分上限。

现有一个函数x=[randn(30,1);5+randn(30,1)];[f,xi]=ksdensity(x);
figure()
subplot(211);
plot(x);
title('样本数据(Sample Data)');
subplot(212);
plot(xi,f);
title('概率密度分布(PDF)');
现在已经知道了概率密度分布曲线,我想求累计概率值为0.8的那个点,请问如何求,谢谢大神指点。

 채택된 답변

dacayog
dacayog 2022년 11월 17일

0 개 추천

1、简单地用prctile 。
x=[randn(30,1);5+randn(30,1)];
prctile(x,80);
ans =5.1951
2、用PDF的话,解方程。
ksdesity得到的是离散的,用fitdist中的Kernel来拟合
x=[randn(30,1);5+randn(30,1)];
pd = fitdist(x,'Kernel');
fzero(@(x)cdf(pd,x)-0.8,5)
ans =5.4071

추가 답변 (0개)

태그

질문:

2022년 11월 17일

답변:

2022년 11월 17일

Community Treasure Hunt

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

Start Hunting!