Can someone help me? - Plotting complex number with index
1 次查看(过去 30 天)
显示 更早的评论
I plotted complex numbers as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630370/image.png)
and I got some complex numbers, like for example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630375/image.png)
result plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630380/image.png)
how do I put the corresponding bit values (1000,1100, ...) according to the example below???
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630385/image.png)
Can someone help me?
0 个评论
采纳的回答
Sulaymon Eshkabilov
2021-5-27
Hi,
Here is the answer to convert imaginary and real numbers from a floating point format into binary:
N = 16; % Number bits for integer part:
M = 25; % Number bits for fraction part:
% Conversion from floating point format into binary number
%% REAL Part:
for ii=1:numel(q_real)
BIN1(ii,:) = fix(rem(q_real(ii)*pow2(-(N-1):M),2));
% Test the inverse transformation
DEC1(ii) = BIN1(ii,:)*pow2(n-1:-1:-m).';
end
%% IMAG Part:
for ii=1:numel(q_imag)
BIN2(ii,:) = fix(rem(q_imag(ii)*pow2(-(N-1):M),2));
% Test the inverse transformation
DEC2(ii) = BIN2(ii,:)*pow2(n-1:-1:-m).';
end
Good luck.
更多回答(1 个)
Sulaymon Eshkabilov
2021-5-26
(1) Separate real and imaginary parts using real(), imag()
(2) PLot them: Real vs. Imag
(3) Convert the separated real and imaginary values (floating point numbers) to binary strings using:
and so forth.
4 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Blue 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!