I am constructing 2 arbitrary PDFs (probability density functions) from a kernel function and representing them as 2 column vectors lets call them A and B.
Each of these pdf is dependant on each other and are a conditional sample of an unknown underlying pdf given information from a previous time step.
My goal is to create a surface of their joint pdf P(A, B) represented by the matrix (edit: due to @Roberts suggestions I'm a little unsure how to construct this now)
I want to then create a normalised (i.e. [0,1]) cumulative distribution function for this surface so I can randomly sample from the surface. (In Matlab)
In 2D it's simply a matter of computing the cumsum
of the pdf i.e.
CDF_A = cumsum(A)
but in 3D I'm not 100% convinced that it's a matter of computing the cumsum
in both directions i.e.
% Possible CDF
Surface = A'*B;
partial_integral = cumsum(Surface,1);
possible_CDF_surface = sumsum(partial_integral,2);
I was hoping SO would have some ideas.
Mathematically, I presume it is simply the bounded double integral (or surface integral) of the function.
In general, if A and B are dependent variables, you can sample from their joint distribution by sampling from the marginal distribution P(A) and then from the conditional distribution P(B | A) using the value of A which you got. (Remember that P(A, B) = P(A | B) P(B) = P(A) P(B | A).) It is not necessary to sample directly from the joint distribution, although I suppose it might or might not be more convenient in specific cases.
It appears that you are assuming that A and B are independent; you have assumed their joint distribution is just P(A) P(B). Therefore, all you have to do is sample A from its distribution and B from its distribution, separately. It is not necessary to construct P(A, B) and sample directly from that (as it must yield the exact same result).