Integrals involving symbolic probability distributions

조회 수: 1 (최근 30일)
Aaron J. Hendrickson
Aaron J. Hendrickson 2017년 7월 17일
댓글: Walter Roberson 2017년 7월 18일
I have the following script:
a1 = 49.5;
a2 = 49.5;
b1 = 153.4787/a1;
b2 = 40.1/a2;
syms x p
assume(p<=0)
fph_n = symfun(int(gampdf(x,a1,b1)*gampdf(-p+x,a2,b2),x,0,Inf), p);
However, I keep getting MuPad errors and not sure why. Can anyone explain?

채택된 답변

Walter Roberson
Walter Roberson 2017년 7월 17일
Unfortunately gampdf is only defined for numeric x; it is not part of the Symbolic toolbox.
The Symbolic Toolbox does have a symbolic equivalent, but it does not have a nice interface to it. See https://www.mathworks.com/help/symbolic/mupad_ref/stats-gammapdf.html and notice this is MuPAD, so to get at it from MATLAB you would need to use feval(symengine) or evalin(symengine)
  댓글 수: 5
Walter Roberson
Walter Roberson 2017년 7월 18일
symLIST = @(varargin)feval(symengine,'DOM_LIST',varargin{:});
symRANGE = @(a,b) feval(symengine, '_range', a, b);
syms a1 b1 a2 b2 x p
dist1 = feval(symengine, 'stats::gammaPDF', a1, b1);
dist2 = feval(symengine, 'stats::gammaPDF', a2, b2);
int(feval(symengine, dist1, x) .* feval(symengine, dist2, -p+x), x, 0, inf)
Unfortunately it leaves it unevaluated unless you give specific numeric a1, b1, a2, b2, and p.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by