%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Project : PON_HD % Module : ScatterColormap % Description : constellation scatterplot with colormap % % References : % %Version|Date |author|Description %-------|--------|------|------------------------------------------------------- %01.01 |20200923|L,YM |Initial version %-------|--------|------|------------------------------------------------------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function SurfColormap(ax,x,y) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% coeffients %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %test MaxLength = 1e5; %1e4 for QuickCheck, 1e5 for accurate check. DataLength = min(length(x), MaxLength); x = x(end - DataLength + 1: end); y = y(end - DataLength + 1: end); DivideNum = 200; % DataMax = max(max(abs(x)),max(abs(y))); DataMax = 1.9; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Scatter Plot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Edges = linspace(-DataMax, DataMax, DivideNum + 1); Constellation = histcounts2(x, y, Edges, Edges); %normalization Constellation = Constellation ./ max(Constellation, [], 'all'); Constellation = ceil(Constellation .* 63) + 1; %1~256. 1=background %rotation Constellation = rot90(Constellation); Constellation = flipud(Constellation); %% plot A = linspace(-DataMax, DataMax, DivideNum); pcolor(ax, A, A, Constellation); % xlabel('I'); % ylabel('Q'); colormap parula map = colormap; map(1,:) = ones(1,3);% white background colormap(map) shading flat%interp% axis equal end%function