How to sum two probability density functions?

24 ビュー (過去 30 日間)
Jules Ray
Jules Ray 2019 年 2 月 25 日
移動済み: John D'Errico 2023 年 5 月 10 日
hello
I have created two probability density functions using this formula:
I would like to sum two of these pdfs and also substract both, but I have not idea how to do it.
Thanks in advance for your help
pd = fitdist(L1.Z(:),'Normal');
x_pdf = [min(L1.Z(:)):0.01:max(L1.Z(:))];
y = pdf(pd,x_pdf);
plot(x_pdf,y,'-')
  2 件のコメント
Jules Ray
Jules Ray 2019 年 2 月 25 日
移動済み: John D'Errico 2023 年 5 月 10 日
Great
that was very clarifying
Just a quick question, this would be the example for add two pdf's: C=[A(:) ; B(:)];
what 's about substracting both?
Thanks again
John D'Errico
John D'Errico 2019 年 2 月 25 日
移動済み: John D'Errico 2023 年 5 月 10 日
Please don't add answers just to ask another question.
Anyway, from reading your various comments, I don't think you understand what a PDF means. Forming the difference of two PDFs has almost no meaning that I can think of.
I think perhaps you want to form the sum and difference of two random variables? That is very, VERY different from forming the sum or difference of two PDFs. Perhaps that is what you mean.

サインインしてコメントする。

採用された回答

ANKUR KUMAR
ANKUR KUMAR 2019 年 2 月 25 日
"sum two of these pdfs and also substract both"?
Are you pretty sure to add the pdfs?
My suggestion is to first add data and then plot the pdf in the regular fashion.
If you facing some issues with plotting pdf, use join the tops of histograms of the data and convert y axis into percentage. This also gives you the probability of occurence of a number in your data.
  3 件のコメント
ANKUR KUMAR
ANKUR KUMAR 2019 年 2 月 25 日
編集済み: ANKUR KUMAR 2019 年 2 月 25 日
There is no any compulsion of using the pre-defined pdf funciton in MATLAB.
PDF is nothing but the probability of occurence of each element.
Let's A is a matrix of m*n size. PDF of A is exactly same as the PDF of A(:).
So, if you wish to sum-up two data sets of different dimension, just convert into row matrices and then merge it up.
A=rand(5,6);
B=rand(7,8);
C=[A(:) ; B(:)];
DIrectly plot the PDF of matrix C. PDF just give the percentage of occurnce of element, nothing else.
ANKUR KUMAR
ANKUR KUMAR 2019 年 2 月 25 日
One of the simplest way to plot Probability Distribution Function is use first draw histogram and then join their tops, follwed by converting Y axis into percentage.

サインインしてコメントする。

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by