How to generate the convolution density and integrate it on [a,b] fastly and precisely?
Show older comments
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!
Accepted Answer
More Answers (1)
Mahesh Taparia
on 22 Aug 2020
1 vote
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 Comments
Walter Roberson
on 22 Aug 2020
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.
Tmat
on 28 Sep 2020
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!