82 lines
3.4 KiB
Matlab
82 lines
3.4 KiB
Matlab
M = wh.parameter.M.values(1);
|
|
datarate = wh.parameter.datarate.values(1);
|
|
sir = wh.parameter.sir.values(4);
|
|
laser_linewidths = wh.parameter.laser_linewidth.values;
|
|
pn_key = wh.parameter.pn_key.values;
|
|
rop = wh.parameter.rop.values;
|
|
|
|
cols = linspecer(4);
|
|
|
|
for laser_linewidth = laser_linewidths
|
|
s_cnt = 0;
|
|
|
|
for s = sir
|
|
s_cnt = s_cnt+1;
|
|
for pnk = pn_key
|
|
|
|
%get ROP curve data for cur. sir and realization
|
|
|
|
ber_ffe = wh.getStoValue('ber_ffe',M,datarate,s,laser_linewidth,pnk,rop);
|
|
ber_dcavg = wh.getStoValue('ber_dcavg',M,datarate,s,laser_linewidth,pnk,rop);
|
|
ber_adapt = wh.getStoValue('ber_adapt',M,datarate,s,laser_linewidth,pnk,rop);
|
|
ber_derem = wh.getStoValue('ber_dcrem',M,datarate,s,laser_linewidth,pnk,rop);
|
|
|
|
rrop_ffe(s_cnt,pnk) = getIntersection(ber_ffe,rop);
|
|
rrop_dcavg(s_cnt,pnk) = getIntersection(ber_dcavg,rop);
|
|
rrop_adapt(s_cnt,pnk) = getIntersection(ber_adapt,rop);
|
|
rrop_derem(s_cnt,pnk) = getIntersection(ber_derem,rop);
|
|
|
|
if 1
|
|
% Create rop plot
|
|
figure(43);
|
|
hold on; % Retain the plot so new points can be added without complete redraw
|
|
plot(rop,ber_ffe',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber ffe",'Color',cols(1,:));
|
|
% scatter(rrop_ffe(s_cnt,pnk),3.8e-3,'LineWidth',2);
|
|
plot(rop,ber_dcavg',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber dcavg",'Color',cols(2,:));
|
|
plot(rop,ber_adapt',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber adapt",'Color',cols(3,:));
|
|
plot(rop,ber_derem',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName","ber dcrem",'Color',cols(4,:));
|
|
yline(3.8e-3,'DisplayName','HD-FEC');
|
|
xlabel('Signal to Interference Ratio (dB)');
|
|
ylabel('Bit Error Rate (BER)');
|
|
title(['Bit Error Rate vs. SIR; SIR: ',num2str(s),' dB']);
|
|
set(gca,'yscale','log');
|
|
grid on;
|
|
legend
|
|
end
|
|
|
|
|
|
end
|
|
end
|
|
|
|
figure(223);
|
|
hold on; % Retain the plot so new points can be added without complete redraw
|
|
% plot(sir,mean(rrop_ffe,2,"omitnan")',"LineWidth",1,"LineStyle",":","Marker",".","MarkerSize",10,"DisplayName","FFE",'Color',cols(1,:));
|
|
% plot(sir,mean(rrop_dcavg,2,"omitnan")',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz'],'Color',cols(2,:));
|
|
% plot(sir,mean(rrop_adapt,2,"omitnan")',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz']);
|
|
plot(sir,mean(rrop_derem,2,"omitnan")',"LineWidth",1,"LineStyle","-","Marker",".","MarkerSize",10,"DisplayName",['Linewidth: ',num2str(laser_linewidth.*1e-6),' MHz']);
|
|
xlabel('Signal to Interference Ratio (dB)');
|
|
ylabel('Receiver Sensitivity');
|
|
title(['Bit Error Rate vs. SIR']);
|
|
grid on;
|
|
legend
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
function i = getIntersection(ber,rop)
|
|
|
|
%get intersection between rop curve and hd-fec limit
|
|
hdfec = 3.8e-3 .* ones(size(ber));
|
|
i = InterX([rop;hdfec'],[rop;ber']);
|
|
|
|
if isempty(i)
|
|
i = NaN;
|
|
else
|
|
i = i(1);
|
|
end
|
|
end
|
|
|
|
|