Complex random variable with unity amplitude and uniform phase distribution?

14 次查看(过去 30 天)
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!

采纳的回答

Ameer Hamza
Ameer Hamza 2020-9-29
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;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by