ASSIGN COMPLEX NUMBERS(X+jY) RANDOM INTEGERS BETWEEN 1 and 3

1 次查看(过去 30 天)
I would like to assign a vector of 5 complex numbers random integers (1 2 3)
say;
1 + j 7 has random number 3
-4 + j2 has random number 2
0.3 - j6 has random number 3
4 + j3 has random number 1
9 + j6 has random number 2

回答(1 个)

KSSV
KSSV 2020-8-11
N = 5 ;
C = zeros(N,1) ;
for i = 1:N
C(i) = randperm(3,1)+1i*randperm(3,1) ;
end

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by