IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Commit d7e207aa authored by Martin Hudlicka's avatar Martin Hudlicka
Browse files

New MATLAB file

parent 36d8a9bb
function F_Plot_Constellation_Diagram_OFDM(Sideal,Symb,params)
% This function plots the reference and received signal constellation
% diagrams and saves it in the evm_results_folder which was taken as
% input from the user in F_UserInputs_Rx().
% The constellation diagram is saved with the filename which was taken as
% input from the user in F_UserInputs_Rx().
% This version has been tested on several monitors and resolutions to
% ensure that it plots reliable constellation diagrams without any adjustment.
%
% Inputs:
% Sideal: Ideal OFDM symbols from ideal signal
% Symb: Recovered OFDM Symbols
% params: Structure containing all the basic communication parameters
global structGlobal
% Create figure
figure1 = figure('NumberTitle','off');
% Create axes
axes1 = axes('Parent',figure1);
hold(axes1,'on');
% Create receiver signal constellation plot
X2 = real(Symb(1:params.Nc*params.NS));
Y2 = imag(Symb(1:params.Nc*params.NS));
plot(X2,Y2,'DisplayName','Received Symbols','MarkerSize',6,'Marker','o','LineWidth',1,'LineStyle','none','Color',[1 0 0]);
% Create reference signal constellation plot
X1 = real(Sideal(1:params.Nc*params.NS));
Y1 = imag(Sideal(1:params.Nc*params.NS));
plot(X1,Y1,'DisplayName','Ideal Symbols','MarkerSize',8,'Marker','*','LineWidth',2,'LineStyle','none','Color','k');
plot(params.Ac*cos(pi*(0:360)/180),params.Ac*sin(pi*(0:360)/180),...
'DisplayName','Average Level','LineWidth',2,'LineStyle','-','Color',[0 0 1]);
% Create xlabel
xlabel('In-Phase (I)','HorizontalAlignment','center','FontSize',24);
% Create ylabel
ylabel('Quadrature (Q)','HorizontalAlignment','center','FontSize',24);
% Create title
stri = strcat(structGlobal.SISmn,' 64-QAM Constellation');
title(stri,'VerticalAlignment','bottom','HorizontalAlignment','center','FontWeight','bold','FontSize',24);
% Create legend
legend1 = legend(axes1,'show');
% Placement of plot legend in MATLAB plot window
set(legend1,'Position',[0.60 0.03 0.35 0.08],'FontSize',14);
% Set the remaining axes/figure properties
axis square
box(axes1,'on');
set(axes1,'XLim',[-params.N/2 params.N/2]);
set(axes1,'xtick',(-params.N/2:1:params.N/2));
set(axes1,'YLim',[-params.N/2 params.N/2]);
set(axes1,'ytick',(-params.N/2:1:params.N/2));
set(axes1,'FontSize',24,'GridAlpha',1,'XGrid','on','YGrid','on');
% Move the plot box up to accomodate the legend
current_position = get(gca, 'Position');
set(gca, 'Position', current_position + [0, +0.02, 0, +0.02]);
% Set the actual height and width of the box
width = 5;
height = 5;
set(gcf, 'Units', 'Inches', 'Position', [1, 1, width+1, height+1], 'PaperUnits', 'Inches', 'PaperSize', [width, height])
set(gca, 'Fontsize', 14);
% Saving figure as graphic file in current directory (plot must still be present in MATLAB plot window)
stri_fig = fullfile(structGlobal.evm_results_folder,strcat(structGlobal.filename_constellation,'.jpg'));
set(figure1,'PaperPositionMode','auto');
print(figure1,stri_fig,'-djpeg','-r300');
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment