How to generate the convolution density and integrate it on [a,b] fastly and precisely?

6 次查看(过去 30 天)
Hi, I have two random variables X following distribution F with density f, and Y following distribution G with density g
random variable Z=X+Y, and I want to calculate the probability that Z belongs to interval [a,b].
I guess this could be done by first get the density of Z as the convolution of f and g, and then do numerical integration to this convolution density over [a,b]. How to do this in a fast and precise way? Thanks!

采纳的回答

Jeff Miller
Jeff Miller 2020-8-22
If your random variables X and Y are independent, Cupid might be helpful. It defines a general convolution RV for any continuous independent RVs. If your distributions are already defined in cupid, the code would look something like:
X = Exponential(1/10); % Illustration with example distributions
Y = Beta(5,2.3);
Z = Convolution(X,Y);
a = 2;
b = 4;
probInterval = Z.CDF(b) - Z.CDF(a);
If either/both of your distributions are not already in Cupid, it is pretty easy to add new distributions if you have the formula for either the PDF or the CDF.
Whether this will be fast and accurate enough for you, I cannot say.

更多回答(1 个)

Mahesh Taparia
Mahesh Taparia 2020-8-22
Hi
You can use 'conv' function to perform the convolution of the CDF and 'integral' function to perform integration. For more information, refer to the documentation of conv function and integral function.
Hope it will help!
  2 个评论
Walter Roberson
Walter Roberson 2020-8-22
You cannot use conv() to do the convolution of a distribution. conv() is only for discrete convolution.
You can use the formal definition of convolution as an integral, which might require the symbolic toolbox.
Alternatively you could potentially use the property that convolution of two functions is the inverse fourier of the multiplication of the fourier transform. This would not be fft, this would be fourier() from the symbolic toolbox.
You can also do something similar with laplace transform.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by