DSPRelated.com
Forums

plotting a random variable in matlab

Started by tpka...@hotmail.com July 26, 2007
Hi All :)

i need to plot the probability density function(pdf) of Z, given that Z = X + Y. X is exponentially distributed with mean x1, Y is exponentially distributed with mean y1. X and Y are independent random variables.

the pdf of Z is given by the convolution of the pdfs of X and Y. How can i plot the pdf of Z in Matlab?
many thanks in advance :)
I don't think that you can plot the pdf in MATLAB per se, if you don't have
a mathematical expression for the pdf of Z. But I think that you can plot
the histogram of the random variable Z by generating a large number of
instances (maybe 10000 or more) of X and Y, adding up the respective
instances and then using the hist() function of MATLAB on Z. The resulting
histogram should have the same shape as the pdf.

If you want a close-to-accurate plot of the pdf you'll have to first derive
the math expression for the pdf of Z, implement the expression for the valid
values of Z and then plot the pdf.

HTH
Sam
On 7/24/07, t...@hotmail.com wrote:
>
> Hi All :)
>
> i need to plot the probability density function(pdf) of Z, given that Z > X + Y. X is exponentially distributed with mean x1, Y is exponentially
> distributed with mean y1. X and Y are independent random variables.
>
> the pdf of Z is given by the convolution of the pdfs of X and Y. How can i
> plot the pdf of Z in Matlab?
>
> many thanks in advance :)
>
>