MATLAB: Integrals involving symbolic probability distributions

integrationsymbolicSymbolic Math Toolbox

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?

Best Answer

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)