start ofc analysis

This commit is contained in:
sioe
2024-10-16 11:14:15 +02:00
parent 3ff9be2d8b
commit 637dd7bc86
4 changed files with 136 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
filename = "C:\Users\sioe\Nextcloud\Dokumente\02_Ablage_Office\Lab_Data_24\bias_sweep\PAM6_10km_ffe__wh.mat";
filename = "C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\Lab_Data_24\bias_sweep\PAM4_10km_ffe__wh.mat";
a = load(filename);
wh2 = a.obj;
@@ -80,7 +80,7 @@ scatter(bestvbias,bestawgvpp,100,"red",'Marker','x','LineWidth',2);
subplot2 = subplot(1,2,2);
% Plot the filled contour plot
contourf_handle = contourf(v_bias_vals, awg_vpp_vals, rop_measured, 'Parent', subplot2);
contourf_handle = contourf(v_bias_vals, awg_vpp_vals, rop_measured, 'Parent', subplot2,"ShowText",true);
% Set x and y labels
xlabel('V_{bias}');

View File

@@ -1,6 +1,6 @@
filename = "C:\Users\sioe\Nextcloud\Dokumente\02_Ablage_Office\Lab_Data_24\bias_sweep_gigantisch\wh_pam4.mat";
filename = "C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\Lab_Data_24\bias_sweep_gigantisch\wh_pam6.mat";
a = load(filename);
wh2 = a.wh;
@@ -8,7 +8,7 @@ wh2 = a.wh;
v_bias_vals = wh2.parameter.vbias.values;
awg_vpp_vals = wh2.parameter.awg_vpp.values;
eq_mode_vals = wh2.parameter.eq_mode.values;
eq_mode_show = eq_mode_vals(2);
eq_mode_show = eq_mode_vals(3);
eq_modes = ["FFE","FFE+MLSE","DB precoded","DB encoded"];
precomp_amp_max_vals = wh2.parameter.precomp_amp_max.values;
@@ -22,7 +22,7 @@ sgtitle(['PAM ', num2str(m),' | EQ: ', char(eq_modes(eq_mode_show))])
for p = 1:numel(precomp_amp_max_vals)
precomp_amp_max_show = precomp_amp_max_vals(p);
subplot1 = subplot(2,3,p);
subplot1 = subplot(1,3,p);
bers = [];
rop_measured = [];
@@ -38,7 +38,7 @@ for p = 1:numel(precomp_amp_max_vals)
bestawgvpp=awg_vpp_vals(awg_pos);
bestvbias=v_bias_vals(v_bias_pos);
disp(['Best Vpp: ',num2str(bestvbias),' V; Best Vpp AWG: ',num2str(bestawgvpp),' V' ])
disp(['Best Vbias: ',num2str(bestvbias),' V; Best Vpp AWG: ',num2str(bestawgvpp),' V' ])
% Compute the logarithm of BER data
% Adding a small epsilon to avoid log(0)
@@ -53,8 +53,8 @@ for p = 1:numel(precomp_amp_max_vals)
contourf_handle = contourf(v_bias_vals, awg_vpp_vals, log_bers, 'Parent', subplot1, "ShowText",true,"LabelFormat", @mylabelfun);
% Set x and y labels with subscripts for clarity
xlabel('V_{bias}');
ylabel('V_{pp} AWG');
xlabel('V_{bias}','Interpreter','tex');
ylabel('V_{pp} AWG','Interpreter','tex');
title(['Prec. Ampl.: ',num2str(precomp_amp_max_show), 'dB']);
% Adjust the grid to display white lines

View File

@@ -0,0 +1,117 @@
% load data points
foldername = 'C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\Lab_Data_24\sir_sweep_pam4';
filename = 'PAM4_10km';
stuff = load([foldername,filesep,filename,'_wh']);
wh = stuff.obj;
i_atten_vals = wh.parameter.i_atten.values;
v_bias = wh.parameter.vbias.values(1);
awg_vpp = wh.parameter.awg_vpp.values(1);
eq_mode = wh.parameter.eq_mode.values(1);
% Tx Bits
% Tx Symbols
% Rx Signal
Bits = load([foldername, filesep, filename, '_bits'],'Bits');
Bits = Bits.Bits;
Symbols = load([foldername, filesep, filename, '_symbols_92gbd'],'Symbols');
Symbols = Symbols.Symbols;
Eq = EQ("Ne",[50,7,7],"Nb",[0,0,0],"training_length",4096*2,"training_loops",5,"dd_loops",5,"K",2,"DCmu",0.0,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
for atten = 0:4:40
Signal_cell = load([foldername, filesep, filename, '_rx_signal_iatten_',num2str(atten)]);
Scpe_sig = Signal_cell.S{1};
bers = wh.getStoValue('ber',v_bias,awg_vpp,eq_mode,atten);
[EQ_sig] = Eq.process(Scpe_sig,Symbols);
EQ_sig.plot("fignum",50,"displayname",'After EQ','clear',1);
Noi = EQ_sig-Symbols;
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
[~,errors_bm,ber_ffe_only,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
nc = 2;
burg_coeff = arburg(Noi.signal,nc);
EQ_sig = EQ_sig.filter(burg_coeff,1);
if 1
Noi.spectrum('displayname','Noise PSD','fignum',123)
[h,w] = freqz(1,burg_coeff,length(Noi),"whole",Noi.fs);
h = h/max(abs(h));
hold on
w_ = (w - Noi.fs/2);
plot(w_.*1e-9,20*log10(fftshift(h)),'DisplayName',['', num2str(nc), ' coefficients for burg alg.']);
end
if 0
figure(53);
constellation = unique(Symbols.signal);
received = NaN(numel(constellation),length(Symbols));
for lvl = 1:numel(constellation)
received(lvl,Symbols.signal==constellation(lvl)) = EQ_sig.signal(Symbols.signal==constellation(lvl));
hold on
histogram(received(lvl,:),1000,"EdgeAlpha",0);
end
end
EQ_sig = MLSE("DIR",burg_coeff,"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels).process(EQ_sig);
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
disp(['FFE: ',sprintf('%.1E',ber_ffe_only),' -> PF -> MLSE: ',sprintf('%.1E',ber),' dB | PD_in: ',num2str(pd_in),' dBm']);
end
cols = linspecer(8);
i_atten_vals = wh.parameter.i_atten.values;
v_bias = wh.parameter.vbias.values(1);
awg_vpp = wh.parameter.awg_vpp.values(1);
eq_mode = wh.parameter.eq_mode.values(1);
bers = wh.getStoValue('ber',v_bias,awg_vpp,eq_mode,i_atten_vals);
figure(90);
hold on; % Retain the plot so new points can be added without complete redraw
% Plot the data and get the line handle
hLine = plot(i_atten_vals, bers, "LineWidth", 0.5, "LineStyle", "-", "Marker", ".", "MarkerSize", 15, "DisplayName", 'nbla');
% Customize the data tips
% Set labels for existing data tip rows
hLine.DataTipTemplate.DataTipRows(1).Label = 'Fsym';
hLine.DataTipTemplate.DataTipRows(2).Label = 'BER';
hLine.DataTipTemplate.DataTipRows(2).Format = '%.2e'; % Format BER as "3e-4"
% Continue with the rest of your plot settings
yline(3.8e-3, 'DisplayName', 'HD-FEC', 'LineStyle', '--', 'HandleVisibility', 'off');
xlabel('Signal to Interference Ratio in dB');
ylabel('Bit Error Rate (BER)');
title('Bit Error Rate vs. SIR');
set(gca, 'yscale', 'log');
set(gca, 'Box', 'on');
grid on;
grid minor;
legend('Interpreter', 'none');
autoArrangeFigures(3,3,2)
disp("measurement done")