How to plot colorful histogram type constellation diagram in Matlab

1 次查看(过去 30 天)
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

回答(1 个)

emehmetcik
emehmetcik 2015-12-12
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

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by