Random numbers from complex PDF
Show older comments
Hi,
I need to generate random complex numbers. My PDF looks like this:
[X, Y] = meshgrid( span, span );
alfaJ = X + 1i*Y;
PDF = 1/(pi*(G-1)) * exp( -abs(alfaJ).^2 / (G-1) );
This PDF looks like this:

And I try to do this to get random numbers:
rePDF = sum(PDF, 1);
reSum = cumsum (rePDF); % is this CDF ok?
nearestRe = abs(reSum - rand);
nearestIm = abs(reSum - rand);
[~, A_Re] = min(nearestRe);
[~, A_Im] = min(nearestIm);
And finally I have:
A = A_Re + 1i*A_Im;
But histograms of A_Re and A_Im are not symetricall and generally i think those random numbers are to large. What is wrong? Is this approach not suited for complex numbers?
Cheers, Alex
2 Comments
jgg
on 21 Apr 2016
You don't seem to be using the covariance of the value when you compute your random numbers, which is why things are messed up. There's nothing special about complex numbers; this is equivalent to trying to sample from a multivariable distribution.
If you know this is normal with a given covariance, you can use mvnrnd.
If it's something else, the best way to do it would be to sample real number first, then using the conditional PDF, sample the complex number afterwards. You need to use use the conditional PDF, though, not the unconditional PDF (which I think is what's going on here)
Alex Kurek
on 21 Apr 2016
Edited: Alex Kurek
on 21 Apr 2016
Accepted Answer
More Answers (0)
Categories
Find more on Uniform Distribution (Continuous) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!