필터 지우기
필터 지우기

indexing complex numbers

조회 수: 3 (최근 30일)
deji
deji 2011년 11월 27일
hi,
I'm trying to index the arrays of as explained below.
a = [-2.2631+2.2631i 2.2631+2.2631i 2.2631+2.2631i 2.2631+2.2631i -2.2631+2.2631i -2.2631-2.2631i -2.2631+2.2631i 2.2631+2.2631i 2.2631-2.2631i -2.2631+2.2631i -2.2631-2.2631i -2.2631+2.2631i -2.2631-2.2631i -2.2631-2.2631i -2.2631+2.2631i -2.2631-2.2631i]
b = [00 01 11 10]
-2.2631+2.26311 will be replaced by 00
2.2631+2.2631i will be replaced by 01
2.2631-2.2631i will be replaced by 11
-2.2631-2.2631i will be replaced by 10
the problem is that i used
x = ( 1 + real(a) ) / 2;
y = ( 1 - imag(a) ) / 2;
b = [ y ; x ]
but i didnt get a 2-dimensional binary bit stream like i was hoping to,instead i got a series of positive nd negative numbers. Pls wat can i do to solve it
Thanks in advance
  댓글 수: 1
David Young
David Young 2011년 11월 28일
It's not clear to me what a 2-dimensional binary bit stream is. Please could you explain what exactly the result should be like: in particular, what class (double, logical, char, uint8 or whatever), and how many rows and columns it should have.

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

답변 (1개)

Rick Rosson
Rick Rosson 2011년 11월 28일
1. Please try the following code:
A = 2.2631;
a = a/A;
2. Then use the same approach as in the answer to this related question

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by