Using MATLAB, what is the best way to find the integral of a bounded range of a CDF?

3 ビュー (過去 30 日間)
Using MATLAB, what is the best way to find the integral of a bounded range of a CDF. I've heard of trapz, cumtrapz, etc. but I do not know the best way to proceed for integrating CDFs. Please refer to the following code:
u = 1;
s = 1;
X = random('Normal',u,s,1,10000);
pd = makedist('Normal','mu',u,'sigma',s);
xAxis = min(X):.0001:max(X);
c_pd = cdf(pd,xAxis);
r = icdf(pd,[.3,.6]);
plot(xAxis,c_pd)
Basically, I am trying to integrate c_pd between the corresponding X values for .3 and .6 (found by using icdf). However, c_pd is a vector and not the actual cdf function. Does anyone have ideas on the best way to find the integral of this regardless of the distribution type (i.e. Normal, Rician, etc.)? Please advise. Thank you.

採用された回答

Mike Hosea
Mike Hosea 2013 年 6 月 7 日
Well, you have the function as well, not just the vector. If I understand you correctly,
integral(@(x)cdf(pd,x),r(1),r(2))
  7 件のコメント
Aaron
Aaron 2013 年 6 月 12 日
Yes, thank you very much. And, I appreciate the clarification on needed to re-define g if pd changes. I would not have known!
Aaron
Aaron 2013 年 6 月 12 日
And thank you to everyone for the help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by