Complex random variable with unity amplitude and uniform phase distribution?

3 ビュー (過去 30 日間)
Davide Mori
Davide Mori 2020 年 9 月 29 日
コメント済み: Ameer Hamza 2020 年 9 月 29 日
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;
  2 件のコメント
Davide Mori
Davide Mori 2020 年 9 月 29 日
Thank you for the quick answer!
Ameer Hamza
Ameer Hamza 2020 年 9 月 29 日
I am glad to be of help! :)

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by