to conrert a complex decimal value into a binary form

조회 수: 2 (최근 30일)
DSP Masters
DSP Masters 2011년 11월 16일
댓글: Inzamamul Haq 2018년 9월 29일
Hi, Please Help me in converting a complex decimal value into its equivalent 32 bit binary value where, first 16 bits represents the real part of the complex value and second 16 bits represents imaginary part of the complex value.. For example: If the value is "0.5 + 0.5i"
I need to get 32 bit => "01000000000000000100000000000000"
Here both real and imaginary part has to be converted to signed q15

답변 (1개)

Walter Roberson
Walter Roberson 2011년 11월 16일
t = real(x);
u = imag(x);
num = uint32(((t<0) + abs(t)) * 2^15) * 2^16 + uint32(((u<0) + abs(u)) * 2^15);
Unless, that is, you really need the bit vector itself:
bits = [+(t<0), dec2bin(fix(abs(t) * 2^15),15)-'0', +(u<0), dec2bin(fix(abs(u) * 2^15)-'0'];
  댓글 수: 1
Inzamamul Haq
Inzamamul Haq 2018년 9월 29일
hello sir,I used this method its working..now i'm having an another doubt from this out put how to re convert the complex number

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

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by