필터 지우기
필터 지우기

How to plot colorful histogram type constellation diagram in Matlab

조회 수: 1 (최근 30일)
Md Ibrahim Khalil
Md Ibrahim Khalil 2015년 11월 28일
답변: emehmetcik 2015년 12월 12일
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에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by