start ofc analysis
This commit is contained in:
117
projects/Lab_2024/offline_dsp_analysis/load_n_dsp.m
Normal file
117
projects/Lab_2024/offline_dsp_analysis/load_n_dsp.m
Normal 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")
|
||||
Reference in New Issue
Block a user