How to plot colorful histogram type constellation diagram in Matlab
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I would like to plot constellation diagram similar to the figure below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152301/image.jpeg)
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
0 commentaires
Réponses (1)
emehmetcik
le 12 Déc 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
0 commentaires
Voir également
Catégories
En savoir plus sur Blue dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!