Convolution of two probability density function
显示 更早的评论
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?
回答(1 个)
Jeff Miller
2019-9-24
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
类别
在 帮助中心 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!