add offline analysis
This commit is contained in:
113
projects/Lab_2024/offline_dsp_analysis/process_vnle_mlse.m
Normal file
113
projects/Lab_2024/offline_dsp_analysis/process_vnle_mlse.m
Normal file
@@ -0,0 +1,113 @@
|
||||
foldername = 'C:\Users\Silas\Nextcloud4\Dokumente\02_Ablage_Office\Lab_Data_24\sir_sweep_pam4';
|
||||
filename = 'PAM4_10km_';
|
||||
|
||||
M = 4;
|
||||
|
||||
Bits = load([foldername, filesep, filename, 'bits'],'Bits');
|
||||
Bits = Bits.Bits;
|
||||
|
||||
Symbols = load([foldername, filesep, filename, 'symbols'],'Symbols');
|
||||
Symbols = Symbols.Symbols;
|
||||
|
||||
all_signals = load([foldername, filesep, filename, 'best_rx_signals']);
|
||||
all_signals = all_signals.all_signals;
|
||||
|
||||
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);
|
||||
eqmode = wh.parameter.eq_mode.values(1);
|
||||
|
||||
|
||||
ber_vnle = zeros(1,numel(all_signals));
|
||||
ber_mlse = zeros(numel(all_signals),3);
|
||||
|
||||
Eq = EQ("Ne",[25,0,0],"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.00,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||
|
||||
Eq = FFE_adaptive_decision("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",1,"buffer_length",80);
|
||||
|
||||
Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",25,"sps",2,"decide",1);
|
||||
|
||||
col = linspecer(11);
|
||||
atten = 40:-4:0;
|
||||
for i = 1:numel(atten)
|
||||
|
||||
sir_measured = wh.getStoValue('sir',v_bias,awg_vpp,eqmode,atten(i));
|
||||
|
||||
Scpe_sig = all_signals(i);
|
||||
|
||||
[EQ_sig, Noi] = Eq.process(Scpe_sig,Symbols);
|
||||
|
||||
Noi.spectrum('displayname',['SIR: ', num2str(sir_measured), ' dB '],'fignum',12345,'color',col(i,:))
|
||||
|
||||
% EQ_sig.plot("fignum",50,"displayname",'After EQ','clear',1);
|
||||
|
||||
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||
|
||||
[~,~,ber_vnle(i),~] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
% for nc = 1:3
|
||||
%
|
||||
% burg_coeff = arburg(Noi.signal,nc);
|
||||
%
|
||||
% EQ_sig_mlse = EQ_sig.filter(burg_coeff,1);
|
||||
%
|
||||
%
|
||||
% if 1
|
||||
% Noi.spectrum('displayname',['SIR: ', num2str(sir_measured), ' dB '],'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);
|
||||
% clf
|
||||
% 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 = MLSE("DIR",burg_coeff,"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels).process(EQ_sig_mlse);
|
||||
%
|
||||
% Rx_bits = PAMmapper(M,0).demap(EQ_sig_mlse);
|
||||
% [~,~,ber_mlse(i,nc),~] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
%
|
||||
% disp(['FFE: ',sprintf('%.1E',ber_vnle(i)),' -> PF -> MLSE: ',sprintf('%.1E',ber_mlse(i,nc)),' dB ']);
|
||||
% end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
bers = wh.getStoValue('ber',v_bias,awg_vpp,eqmode,i_atten_vals);
|
||||
sirs = wh.getStoValue('sir',v_bias,awg_vpp,eqmode,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
|
||||
hLine1 = plot(sirs, (ber_vnle), "LineWidth", 0.5, "LineStyle", "-", "Marker", ".", "MarkerSize", 15, "DisplayName", 'VNLE 2');
|
||||
hLine2 = plot(sirs, (ber_mlse(:,1)), "LineWidth", 0.5, "LineStyle", "-", "Marker", "o", "MarkerSize", 15, "DisplayName", ['VNLE + PF ',num2str(1),' taps + MLSE']);
|
||||
hLine2 = plot(sirs, (ber_mlse(:,2)), "LineWidth", 0.5, "LineStyle", "-", "Marker", "x", "MarkerSize", 15, "DisplayName", ['VNLE + PF ',num2str(2),' taps + MLSE']);
|
||||
hLine2 = plot(sirs, (ber_mlse(:,3)), "LineWidth", 0.5, "LineStyle", "-", "Marker", "square", "MarkerSize", 15, "DisplayName", ['VNLE + PF ',num2str(3),' taps + MLSE']);
|
||||
% hLine3 = plot(sirs, bers, "LineWidth", 0.5, "LineStyle", "-", "Marker", ".", "MarkerSize", 15, "DisplayName", 'from measurement');
|
||||
|
||||
% 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');
|
||||
Reference in New Issue
Block a user