필터 지우기
필터 지우기

how to plot the PDF of a random variable

조회 수: 3 (최근 30일)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2018년 9월 18일
댓글: MAHMOUD ALZIOUD 2018년 9월 19일
Dear All, I have CDF from which I derived the marginal PDF, how can I please plot this pdf which is called here MarginalPDFx?
syms x y
Fxy = 1-exp(-x)-exp(-y)+exp(-(x+y+x*y)); %Given CDF of X & Y
JPDFxy = (x+y+x*y)*exp(-(x+y+x*y)); %Calculated Joint PDF of X & Y
MarginalPDFx = int(JPDFxy,y,0,inf); %Formula for Marginal PDF of X
MarginalPDFy = int(JPDFxy,x,0,inf); %Formula for Marginal PDF of Y

채택된 답변

Dimitris Kalogiros
Dimitris Kalogiros 2018년 9월 18일
편집: Dimitris Kalogiros 2018년 9월 18일
From the integral that you use in order to calculate marginal PDFs, I guess that x,y are into the interval [0, +inf].
clearvars; clc; close all;
syms x y
Fxy(x,y) = 1-exp(-x)-exp(-y)+exp(-(x+y+x*y)); %Given CDF of X & Y
JPDFxy(x,y) = (x+y+x*y)*exp(-(x+y+x*y)); %Calculated Joint PDF of X & Y
MarginalPDFx(x) = int(JPDFxy,y,0,inf) %Formula for Marginal PDF of X
MarginalPDFy(y) = int(JPDFxy,x,0,inf) %Formula for Marginal PDF of Y
r=0:0.1:10; %plot PDFs for 0<x,y<10
pdfx=zeros(size(r));
pdfy=zeros(size(r));
for n=1:length(r)
pdfx(n)=MarginalPDFx(r(n));
pdfy(n)=MarginalPDFy(r(n));
end
figure;
subplot(2,1,1); plot(r,pdfx,'-b'); grid on; legend('PDFx');
subplot(2,1,2); plot(r,pdfy,'-r'); grid on; legend('PDFy');
Since Fxy is symmetrical, two PDFs are indentical:
  댓글 수: 1
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2018년 9월 19일
Thank you Sir for your help, it worked

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by