151 lines
4.1 KiB
Matlab
151 lines
4.1 KiB
Matlab
function plotHistogram(wh,plotJob)
|
|
|
|
|
|
fig = findall(groot, 'Type', 'figure', 'Name', plotJob.figName);
|
|
|
|
if isvalid(fig)
|
|
figure(fig)
|
|
fig = get(fig);
|
|
AxesMain = fig.CurrentAxes;
|
|
hold on
|
|
else
|
|
fig = figure('name',char(plotJob.figName));
|
|
AxesMain = gca;
|
|
hold on
|
|
end
|
|
|
|
col = plotJob.color;
|
|
|
|
% we want to fetch all realizations
|
|
realization = wh.parameter.realization.values(1:end);
|
|
|
|
% get all xAxis values
|
|
xAxis = wh.parameter.p_out.values;
|
|
|
|
|
|
% Fetch Data from Warehouse
|
|
for xl = 1:numel(xAxis)
|
|
p_out = xAxis(xl);
|
|
if string(plotJob.dataStatArg) == "Worst"
|
|
ber(xl) = max(wh.getStoValue('ber',plotJob.l,plotJob.d,plotJob.sgm,string(plotJob.pol),plotJob.p_in,p_out,plotJob.pmd,plotJob.gamma,realization,string(plotJob.channelplan),string(plotJob.dsp)),[],'all');
|
|
linew = 2.0;
|
|
markersz = 3;
|
|
linestyle = '-';
|
|
elseif string(plotJob.dataStatArg) == "AVG"
|
|
ber(xl) = mean(wh.getStoValue('ber',plotJob.l,plotJob.d,plotJob.sgm,string(plotJob.pol),plotJob.p_in,p_out,plotJob.pmd,plotJob.gamma,realization,string(plotJob.channelplan),string(plotJob.dsp)),'all');
|
|
linew = 2.0;
|
|
markersz = 3;
|
|
linestyle = ':';
|
|
elseif string(plotJob.dataStatArg) == "Best"
|
|
ber(xl) = min(wh.getStoValue('ber',plotJob.l,plotJob.d,plotJob.sgm,string(plotJob.pol),plotJob.p_in,p_out,plotJob.pmd,plotJob.gamma,realization,string(plotJob.channelplan),string(plotJob.dsp)),[],'all');
|
|
linew = 2.0;
|
|
markersz = 3;
|
|
linestyle = ':';
|
|
|
|
elseif string(plotJob.dataStatArg) == "All Channels; mean(PMD Realizations)"
|
|
tmp = wh.getStoValue('ber',plotJob.l,plotJob.d,plotJob.sgm,string(plotJob.pol),plotJob.p_in,p_out,plotJob.pmd,plotJob.gamma,realization,string(plotJob.channelplan),string(plotJob.dsp));
|
|
|
|
if numel(tmp(tmp==0)) ~= 0
|
|
disp('Removed all zero values!');
|
|
tmp(tmp==0) = NaN;
|
|
end
|
|
ber(:,xl) = mean(tmp,1,"omitnan").';
|
|
|
|
linew = 0.7;
|
|
markersz = 2;
|
|
linestyle = '-';
|
|
|
|
elseif string(plotJob.dataStatArg) == "All Channels ;All PMD Realizations"
|
|
|
|
|
|
|
|
tmp = reshape(wh.getStoValue('ber',plotJob.l,plotJob.d,plotJob.sgm,string(plotJob.pol),plotJob.p_in,p_out,plotJob.pmd,plotJob.gamma,realization,string(plotJob.channelplan),string(plotJob.dsp)).',[],1);
|
|
ber(1:size(tmp,1),xl) = tmp;
|
|
|
|
linew = 0.3;
|
|
markersz = 2;
|
|
linestyle = ':';
|
|
end
|
|
end
|
|
|
|
disp('Removed all zero values!');
|
|
ber(ber==0) = NaN;
|
|
if ~anynan(ber)
|
|
[xAxis,ber] = interpCurve(xAxis, ber);
|
|
end
|
|
|
|
% plot FEC Crossing as histogram
|
|
|
|
hdfec = 3.8e-3.*ones(size(xAxis));
|
|
S = [];
|
|
for i = 1:size(ber,1)
|
|
a = InterX([hdfec;xAxis],[ber(i,:);xAxis]);
|
|
if ~isempty(a)
|
|
S(:,i) = a;
|
|
end
|
|
end
|
|
|
|
|
|
%% SUB 1
|
|
AxesMain = subplot(2,1,1);
|
|
|
|
hold on
|
|
|
|
if ~isempty(S)
|
|
histogram(S(end,:),300,'Normalization','probability','FaceColor',col,'EdgeColor',col,'Parent',AxesMain,'DisplayName',[plotJob.dataStatArg,' Ch.: ', plotJob.displayname],'FaceAlpha',0.4,'EdgeAlpha',0.4);
|
|
end
|
|
|
|
xlim([-3 ,9 ]);
|
|
ylim([0 .10]);
|
|
|
|
% Figure Settings
|
|
title(AxesMain,['$P_{in}:$ ',num2str(plotJob.p_in-9), 'dBm; L : ', num2str(plotJob.l),'Km'],'Interpreter','latex');
|
|
|
|
xlabel(AxesMain,plotJob.xAxisLabel,'Interpreter','latex');
|
|
|
|
ylabel('PDF')
|
|
|
|
grid(AxesMain,'on');
|
|
|
|
grid(AxesMain,'minor');
|
|
|
|
%legend(AxesMain,'Interpreter','latex');
|
|
|
|
fontsize(AxesMain,24,"pixels")
|
|
|
|
hold off
|
|
|
|
|
|
%% SUB 2
|
|
AxesMain = subplot(2,1,2);
|
|
|
|
if ~isempty(S)
|
|
hold on
|
|
|
|
[f1,x1]=ecdf(S(end,:));
|
|
plot(x1,f1,'r','LineWidth',3, 'Color',col,'DisplayName',[plotJob.dataStatArg,' Ch.: ', plotJob.displayname]);
|
|
end
|
|
xlim([-3 ,9 ]);
|
|
ylim([0 1]);
|
|
% Figure Settings
|
|
title(AxesMain,['$P_{in}:$ ',num2str(plotJob.p_in-9), 'dBm; L : ', num2str(plotJob.l),'Km'],'Interpreter','latex');
|
|
|
|
xlabel(AxesMain,plotJob.xAxisLabel,'Interpreter','latex');
|
|
|
|
ylabel('CDF')
|
|
|
|
grid(AxesMain,'on');
|
|
|
|
grid(AxesMain,'minor');
|
|
|
|
fontsize(AxesMain,24,"pixels")
|
|
|
|
%legend(AxesMain,'Interpreter','latex');
|
|
|
|
fig.Position = plotJob.Position;
|
|
|
|
hold off
|
|
|
|
|
|
|
|
end |