Convolution of two probability density function
8 views (last 30 days)
Show older comments
Hello:
I am interested to add two independent random variables, X1 and X2, described by kernel density functions. Is there any way to find out the joint PDF using convolution process in MATLAB?
0 Comments
Answers (1)
Jeff Miller
on 24 Sep 2019
I don't know whether you can do this directly in MATLAB. If not, you can do it using the Cupid toolbox. Here is an example:
% Generate some data to use for an example:
data1 = randn(200,1);
data2 = 20*rand(300,1);
% Make the corresponding MATLAB kernel distribution objects:
kern1 = fitdist(data1,'Kernel');
kern2 = fitdist(data2,'Kernel');
% Derive Cupid distribution objects from MATLAB ones:
ckern1 = dMATLABc(kern1);
ckern2 = dMATLABc(kern2);
% Make a Convolution distribution from the Cupid distribution objects:
convkern = Convolution(ckern1,ckern2);
% Compute various properties of the convolution distribution:
a = convkern.Median
b = convkern.Mean
c = convkern.Variance
d = convkern.PDF(12)
e = convkern.CDF(13)
convkern.PlotDens; % Plot PDF and CDF
% et cetera
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!