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

조회 수: 1 (최근 30일)
Herbert Nyakoojo
Herbert Nyakoojo 2020년 8월 11일
댓글: Herbert Nyakoojo 2020년 8월 14일
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
  댓글 수: 3
KSSV
KSSV 2020년 8월 12일
What do you mean by associate?
Herbert Nyakoojo
Herbert Nyakoojo 2020년 8월 14일
thanks I got a way out

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by