How to plot colorful histogram type constellation diagram in Matlab

1 visualización (últimos 30 días)
Md Ibrahim Khalil
Md Ibrahim Khalil el 28 de Nov. de 2015
Respondida: emehmetcik el 12 de Dic. de 2015
I would like to plot constellation diagram similar to the figure below.
My approach is something like this
clc;
clear all;
close all;
N=30000;
M=16;
Sr=randint(N,1,[0,(M-1)]);
S=qammod(Sr,16,0,'gray'); S=S(:);
Noisy_Data=awgn(S,20,'measured'); % Add AWGN
figure(2)
subplot(1,2,1)
plot(S,'o','markersize',10);
grid on
subplot(1,2,2)
plot(Noisy_Data,'.');
grid on
May you assist me to make necessary modification to get graph similar to the figure attached above. Thank you

Respuestas (1)

emehmetcik
emehmetcik el 12 de Dic. de 2015
You can use hist3 function. Here is an example for "Noisy_Data" in your code:
figure;
z = [real(Noisy_Data), imag(Noisy_Data)];
Mx = 100; % Number of grids in x axis
My = 100; % Number of grids in y axis
x = linspace(min(z(:, 1)), max(z(:, 1)), Mx);
y = linspace(min(z(:, 2)), max(z(:, 2)), My);
hz = hist3(z, [Mx, My]);
hz(hz==0) = nan;
pcolor(x, y, hz)
set(get(gca,'child'),'FaceColor','interp','CDataMode','auto');
view(2); shading flat
colormap(jet)
colorbar

Categorías

Más información sobre Blue en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by