Complex random variable with unity amplitude and uniform phase distribution?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Davide Mori
am 29 Sep. 2020
Kommentiert: Ameer Hamza
am 29 Sep. 2020
Hi,
I need to add a random phase shift to a vector. What can I use to create a complex random variable with unity amplitude and a uniform phase distribution over [0,2pi)?
Thank you!
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 29 Sep. 2020
n = 1000; % generate n complex numbers
mag = 1; % magnitude of complex numbers
phases = rand(1, n)*2*pi; % phases of complex numbers from 0 to 2*pi
[re, im] = pol2cart(phases, mag);
rand_complex = re + im*1i;
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!