MATLAB Answers

Inverse Cumulative distribution function

조회 수: 4(최근 30일)
Bashar AlHalaq
Bashar AlHalaq 2021년 3월 30일
댓글: Jeff Miller 2021년 4월 6일
if i have the following CDF :
How can I find x=inverse(F(x))
with my best reguards

채택된 답변

Jeff Miller
Jeff Miller 2021년 3월 31일
Suppose you have a function called thisCDF which computes the CDF for your distribution. Then define
function x = inverseF(p)
inverseFerr = @(x) thisCDF(x) - p;
x = fzero(inverseFerr,0.5); % replace 0.5 with a starting guess for x
x = inverseF(0.5) % compute the median, etc
  댓글 수: 5
Jeff Miller
Jeff Miller 2021년 4월 6일
I don't know what you are trying to compute so I can't say for sure whether your code is correct, but a few things make me suspect it is not correct:
  • The CDF should reach 1 and not stabilize at 0.7. Maybe your CDF function is not correct (e.g., why does it start with 1/1+... which is the same as 1+....?). What distribution are you actually trying to work with?
  • Your inverseF function does not call fzero so it is not getting x values with the cdf of u. Instead, it is computing the CDF of u.

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Riley 2021년 3월 30일
You can use function ksdensity.


Community Treasure Hunt

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

Start Hunting!

Translated by