I have a joint density function for two independent variables X and Y. And I now want to sample new x,y from this distribution.
What I believe I have to do is to find the joint cumulative distribution and then somehow sample from it. I kinda know how to do this in 1D, but I find it really hard to understand how to do it in 2D.
I also used the matlab function cumtrapz
to find the cumulative distribution function for the above pdf.
Just to be clear, what i want to do is to sample random values x,y from this empirical distribution.
Can someone please point me in the right direction here?!
EDIT: I have data values and I use [pdf bins] = hist3([N Y])
I then normalize the pdf and do
cumulativeDistribution = cumtrapz(pdfNormalize)
And yes (to the comment below) X,Y are suppose to be independent.