how do i label my points?
are complex points.
My code is as follows:
clear all;
close all;
clc;
L = 1e4; % Number of bits
SNRdB = 0:28;
SNR = 10.^(SNRdB/10);
r = 10.^(SNRdB/10);
alpha = 0.3;
max_run = 100;
for sk = 1:length(SNRdB)
for tk = 1:max_run
% 1 ou -1 para sinal em fase (an)
x_inp_I = sign(rand(1,L)- 0.5);
% 1 ou -1 para sinal de quadratura (bn)
x_inp_Q = sign(rand(1,L)- 0.5);
QPSK = x_inp_I + 1i .* x_inp_Q;
% Gera bits de marca d'água aleatórios (dI)
Bit_wat_I = sign(rand(1,L)- 0.5);
% Gera bits de marca d'água aleatórios (dQ)
Bit_wat_Q = sign(rand(1,L)- 0.5);
% Outra forma de encontrar a equação
for k = 1:L
if Bit_wat_I(k) == 1 && Bit_wat_Q(k) == 1
Bit_enviado(k) = (x_inp_I(k) .* ((sqrt(1-alpha)) + (sqrt(alpha)))) + (1i .* x_inp_Q(k) * ((sqrt(1-alpha)) + (sqrt(alpha))));
end
end
end
end
h = scatterplot(QPSK);
hold on
scatterplot(Bit_enviado,[],[],'r*',h)
I would like to label it with bits like the example below:

댓글 수: 3

The code you shared does not produe that plot.
Adam Danz
Adam Danz 2021년 5월 27일
Where do the binary values come from? How are they related to the points?
adriane duarte
adriane duarte 2021년 5월 30일
the random bits are produced through the variables:x_inp_I,x_inp_Q,Bit_wat_I and Bit_wat_Q.
then I use it in an equation to reproduce my complex points.

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

 채택된 답변

Image Analyst
Image Analyst 2021년 5월 27일

1 개 추천

Did you try calling text()?

댓글 수: 4

yea!!
I've done it in two ways:
First:
- I separated the real from the imaginary
q_real = real (Bit_enviado);
q_imag = imag (Bit_enviado);
- I applied strings to each one
str = string (q_real);
str1 = string (q_imag);
textscatter (q_real, q_imag, str);
But it doesn't come out the way I want it. a factor comes out
Second:
- I separated the real from the imaginary
q_real = real (Bit_enviado);
q_imag = imag (Bit_enviado);
- I turned each one into binary
bits32_real = dec2bin (typecast (single (q_real), 'uint32'));
bits32_imag = dec2bin (typecast (single (q_imag), 'uint32'));
or
z2_real = reshape (dec2bin (typecast (q_real, 'uint32'), 4). ', 1, []);
z2_imag = reshape (dec2bin (typecast (q_imag, 'uint32'), 4). ', 1, []);
Then I don't know what else to do.
Can you help me? @Image Analyst
You can loop over all (x,y) coordinates and call text() with the binary string - the 0101 or whatever:
for k = 1 : length(x)
thisx = x(k);
thisy = y(k);
binaryString = whatever you have to do to get it
text(thisx, thisy, binaryString, 'Color', 'r', 'FontSize', 15, 'FontWeight', 'bold');
end
Image Analyst
Image Analyst 2021년 5월 28일
편집: Image Analyst 2021년 5월 28일
So did you try the code in my comment above (click "Show older comments" link above to see it)?
I can't run your program because
'scatterplot' requires Communications Toolbox.
You forgot to add the Communications Toolbox to the product list when you posted so I'll add it now.
adriane duarte
adriane duarte 2021년 5월 30일
편집: adriane duarte 2021년 5월 30일
Oi!!!
Eu testei seu código sim!
obrigado.
Você poderia me ajudar com outra pergunta? @Image Analyst

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

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 5월 27일
편집: Sulaymon Eshkabilov 2021년 5월 27일

1 개 추천

Hi,
(1) you need to create binary representation of your plotted points using dec2bin() for labels to display on the plot
(2) to put labels to all of your plotted points, you can employ this code written by Adam Danz
https://www.mathworks.com/matlabcentral/fileexchange/46891-labelpoints

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

질문:

2021년 5월 27일

댓글:

2021년 5월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by