现有一个函数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的那个点,请问如何求,谢谢大神指点。

 Réponse acceptée

dacayog
dacayog le 17 Nov 2022

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!