Files
imdd_silas/projects/MPI/MPI_Juni/ber_curve.m
2026-03-25 10:57:48 +01:00

47 lines
1.7 KiB
Matlab

function ber_curve(wh,options)
arguments
wh
options.DisplayName = '';
end
M = wh.parameter.M.values(1);
datarate = wh.parameter.datarate.values;
sir = wh.parameter.sir.values(1);
laser_linewidth = wh.parameter.laser_linewidth.values(1);
pn_key = wh.parameter.pn_key.values(1);
vbias_rel = wh.parameter.vbias_rel.values(1);
rop = wh.parameter.rop.values;
clipfactor = wh.parameter.clipfactor.values;
rrcalpha = wh.parameter.rrcalpha.values(1);
cols = linspecer(numel(datarate));
cnt = 0;
for dr = datarate
cnt = cnt+1;
bers = wh.getStoValue('ber',M,dr,sir,laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
rops = wh.getStoValue('rop',M,dr,sir,laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha);
ers = unique(wh.getStoValue('er',M,dr,sir,laser_linewidth,pn_key,vbias_rel,rop,clipfactor, rrcalpha));
if 1 %isempty(options.DisplayName)
dn = ['M: ',num2str(M),'; Rate: ',num2str(dr),'; Vbias rel: ',num2str(vbias_rel), '; ER: ', num2str(ers)];
else
dn = options.DisplayName;
end
% Create the initial plot
figure(43);
hold on; % Retain the plot so new points can be added without complete redraw
plot(rops,bers,"LineWidth",1,"LineStyle","--","Marker",".","MarkerSize",10,"DisplayName",string(dn),'Color',cols(cnt,:));
end
yline(3.8e-3,'DisplayName','HD-FEC');
xlabel('Received Optical Power (dBm)');
ylabel('Bit Error Rate (BER)');
title('Bit Error Rate vs. Received Optical Power');
set(gca,'yscale','log');
grid on;
legend
end