Compare commits
12 Commits
revert-798
...
silas_wip
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18ccaf8c12 | ||
|
|
c0a0a415a8 | ||
|
|
2a724b833f | ||
|
|
1b8d83dec0 | ||
|
|
3edd64d365 | ||
|
|
58e72070d9 | ||
|
|
bc8ebc044f | ||
|
|
3d47813f1e | ||
|
|
46172bbd5d | ||
|
|
7c9577791d | ||
|
|
4e233bde95 | ||
|
|
7565ed0cf1 |
@@ -172,9 +172,9 @@ classdef Signal
|
||||
|
||||
hold on;
|
||||
if isempty(options.color)
|
||||
plot(t* 1e6, sig(1:length(t)), 'DisplayName', dn, 'LineWidth', 0.1, 'Marker', '.', 'LineStyle','none', 'MarkerSize', 0.1);
|
||||
plot(t* 1e6, sig(1:length(t)), 'DisplayName', dn, 'LineWidth', 0.1, 'Marker', 'none', 'LineStyle','-', 'MarkerSize', 0.1);
|
||||
else
|
||||
plot(t* 1e6, sig(1:length(t)), 'DisplayName', dn, 'LineWidth', 0.1, 'Marker', '.', 'LineStyle','none', 'MarkerSize', 0.1,'Color',options.color);
|
||||
plot(t* 1e6, sig(1:length(t)), 'DisplayName', dn, 'LineWidth', 0.1, 'Marker', 'none', 'LineStyle','-', 'MarkerSize', 0.1,'Color',options.color);
|
||||
end
|
||||
% 2 c)
|
||||
% - xlabel if not already here: time in readable format (1 ms and not 1e-3 s)
|
||||
@@ -927,7 +927,7 @@ classdef Signal
|
||||
options.displayname = "";
|
||||
end
|
||||
|
||||
mode = 2;
|
||||
mode = 1;
|
||||
|
||||
histpoints = 2048; %% verticale resolution
|
||||
histpoints = floor(histpoints/2)*2+1; %% to have the eye digram centered around one point make the vertical resolution uneven
|
||||
@@ -978,8 +978,8 @@ classdef Signal
|
||||
maxA = max(sig(100:end-100))*1.3;
|
||||
minA = min(sig(100:end-100))*1.3;
|
||||
|
||||
maxA = 0.12;
|
||||
minA = -0.08;
|
||||
% maxA = 0.12;
|
||||
% minA = -0.08;
|
||||
|
||||
difference= maxA-minA;
|
||||
|
||||
|
||||
@@ -462,10 +462,19 @@ classdef PAMmapper
|
||||
|
||||
end
|
||||
|
||||
function [Signal_out] = quantize(obj,Signal_in)
|
||||
function [Signal_out] = quantize(obj,Signal_in,options)
|
||||
arguments
|
||||
obj
|
||||
Signal_in
|
||||
options.custom_const = []
|
||||
end
|
||||
|
||||
if isempty(options.custom_const)
|
||||
constellation = obj.get_levels();
|
||||
constellation = constellation ./ obj.scaling;
|
||||
else
|
||||
constellation = options.custom_const;
|
||||
end
|
||||
|
||||
issignalclass = 0;
|
||||
if isa(Signal_in,'Signal')
|
||||
|
||||
@@ -300,8 +300,8 @@ classdef Filter < handle
|
||||
xline(fcut_,'LineStyle',':','LineWidth',1,'HandleVisibility','off','Color',p.Color);
|
||||
yline([-3, -6, -9],'LineStyle',':','LineWidth',1,'HandleVisibility','off');
|
||||
|
||||
xlim([0 fc.*2].*1e-9);
|
||||
ylim([ninedB-6, 2]);
|
||||
% xlim([0 fc.*2].*1e-9);
|
||||
% ylim([ninedB-6, 2]);
|
||||
legend
|
||||
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ classdef Photodiode
|
||||
options.responsivity = 1;
|
||||
options.dark_current = 0;
|
||||
options.temperature = 20;
|
||||
options.nep = 0; %(Moveit IMDD Standard: 1.8e-11) noise effective power in pA/sqrt(Hz); usually between 10-20 pA; see J.Leibrich Diss/ S. Pachnicke Slides
|
||||
options.nep = 0; %(Moveit IMDD Standard: 1.8e-11 == current noise density in A/sqrt(Hz)! ); usually between 10-20 pA/sqrt(Hz); see J.Leibrich Diss/ S. Pachnicke Slides
|
||||
options.randomkey = 1;
|
||||
end
|
||||
|
||||
@@ -72,9 +72,16 @@ classdef Photodiode
|
||||
yout = yout + shot_noise;
|
||||
|
||||
% Thermal Noise
|
||||
% 2026 comment: obj.nep is not the correct naming, but math-wise everything is fine!
|
||||
% (2 * k * T / R ) -> A^2/Hz -> is the psd of thermal noise
|
||||
% earlier: move it's 1.8e-11 is current noise density -> A/sqrt(Hz)
|
||||
|
||||
% power (of white process) is simple multiplication of PSD(f) and B
|
||||
|
||||
|
||||
% NEP is noise equivalent power, see Dissertation j. Leibrich
|
||||
% P. 121 or Stephan Pachnicke Optical Comm. Lecture Slides
|
||||
if obj.nep == 0
|
||||
if obj.nep == 0 %
|
||||
nep_squared = (2 * k * T / R ) ; %squared
|
||||
else
|
||||
nep_squared = obj.nep^2;
|
||||
|
||||
@@ -10,6 +10,12 @@ classdef EQ < handle
|
||||
training_length %Number of training symbols
|
||||
training_loops %Number of loops through sequence for training mode
|
||||
ideal_dfe %Error free DFE decisions
|
||||
weighted_DFE %Weighted DFE off (0)/on (1)/PDFE (2)
|
||||
weighted_DFE_mode %Weighted DFE mode
|
||||
weighted_DFE_d_min %d_min threshold parameter for weighted DFE mode 1
|
||||
weighted_DFE_I_mode %[a_s, b_s, I_max]-parameters for the weighted DFE
|
||||
PDFE_coefficient %Coefficient for PDFE
|
||||
weighted_error %error based on hard- or weighted decision
|
||||
|
||||
DB_aim %Aim at duobinary output sequence
|
||||
|
||||
@@ -39,7 +45,6 @@ classdef EQ < handle
|
||||
|
||||
save_taps
|
||||
|
||||
|
||||
%during simulation
|
||||
k0
|
||||
b
|
||||
@@ -68,6 +73,12 @@ classdef EQ < handle
|
||||
options.training_length = 1024 %Number of training symbols
|
||||
options.training_loops = 1 %Number of loops through sequence for training mode
|
||||
options.ideal_dfe = 0 %Error free DFE decisions
|
||||
options.weighted_DFE = 0;
|
||||
options.weighted_DFE_mode = 'R1';
|
||||
options.weighted_DFE_d_min = 0.5;
|
||||
options.weighted_DFE_I_mode = [5,0.5,0.6];
|
||||
options.PDFE_coefficient = 0.5;
|
||||
options.weighted_error = 0; %0: Error based on hard-decision. 1: Error based on weighted decision.
|
||||
|
||||
options.DB_aim %Aim at duobinary output sequence
|
||||
|
||||
@@ -235,19 +246,11 @@ classdef EQ < handle
|
||||
cnt = 1;
|
||||
m = obj.k0+1; % starting symbol index at the delay compared to the training sequence
|
||||
|
||||
|
||||
|
||||
% n => index in rx data sequence
|
||||
%Step From: Oversampling(=2) * Startdelay + 1
|
||||
%Step Width: Oversampling(=2)
|
||||
%Step To: Oversampling(=2) * Training Length
|
||||
for n = obj.K*obj.k0+1:obj.K:obj.K*obj.training_length
|
||||
|
||||
% m => index in reference sequence
|
||||
m = m+1;
|
||||
|
||||
%
|
||||
%dc_ = mean(data(obj.Ne(1)+n+(obj.K-1):-1:n+obj.K).');
|
||||
% cut symbols from rx data sequence
|
||||
X_1 = data(obj.Ne(1)+n+(obj.K-1):-1:n+obj.K).';
|
||||
|
||||
@@ -267,8 +270,6 @@ classdef EQ < handle
|
||||
|
||||
error = e_dc + e_ffe - e_dfe - ref_in(m-obj.k0);
|
||||
|
||||
%error = e_dc + e_.'*input_vec - b_.'*reference_vec - ref_in(m-obj.k0);
|
||||
|
||||
if real(obj.FFEmu)
|
||||
if obj.l1act
|
||||
sgn_e = e_;
|
||||
@@ -289,28 +290,13 @@ classdef EQ < handle
|
||||
|
||||
e_dc = e_dc - obj.DCmu*error;
|
||||
|
||||
% obj.error_log.e_ffe(cnt,trainloops) = e_ffe;
|
||||
% obj.error_log.e_dfe(cnt,trainloops) = e_dfe;
|
||||
% obj.error_log.e_(cnt,trainloops) = error;
|
||||
|
||||
cnt = cnt+1;
|
||||
if obj.Nb(1) > 0
|
||||
b_ = b_ + obj.DFEmu*error*reference_vec; % Seems like normalized DFE has worse performance
|
||||
end
|
||||
|
||||
% figure(111);stem((e_),'Markersize',2);ylim([-1 1]);title('FFE Filter Taps');
|
||||
%
|
||||
% figure(222);
|
||||
% stem(input_vec);ylim([-3 3]);
|
||||
% hold on;
|
||||
% stem(reference_vec);ylim([-3 3]);
|
||||
% yline(error,'LineWidth',2); title('Input Vector');
|
||||
% hold off
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
%%
|
||||
% Plot the intermediate coefficients after training mode
|
||||
obj.b = b_(1:obj.Nb(1));
|
||||
@@ -341,10 +327,8 @@ classdef EQ < handle
|
||||
subplot(2,3,6);stem(obj.b3,'Markersize',2);
|
||||
title('DFE coeff nl 3rd')
|
||||
xlabel('coefficient index'); ylabel('value'); set(gca,'Fontsize',12)
|
||||
%set(gcf,'Position',[200 500 700 400])
|
||||
end
|
||||
|
||||
|
||||
if obj.l1act
|
||||
neg_lin = find(abs(obj.e) < obj.thres(1));
|
||||
neg_2nd = find(abs(obj.e2) < obj.thres(2));
|
||||
@@ -393,6 +377,7 @@ classdef EQ < handle
|
||||
cnt = 1;
|
||||
m = 0;
|
||||
output_vec = zeros(1,floor(length(data_in)/obj.K)); % initilaization of the output vector
|
||||
output_vec_weighted = zeros(size(output_vec));
|
||||
dd_DFE = zeros(obj.Nb(1),1);
|
||||
D_2 = zeros(Nb2,1);
|
||||
D_3 = zeros(Nb3,1);
|
||||
@@ -410,7 +395,6 @@ classdef EQ < handle
|
||||
if obj.load_decisions
|
||||
pathn = evalin('base','modeldir');
|
||||
temp = load([pathn, 'MLSE_out', '.mat']) ;
|
||||
%eval(['dd_out_vals = temp.', 'a', ';']) ;
|
||||
dd_out_vals=temp.a;
|
||||
dd_out = zeros(size(data_in));
|
||||
dd_out(1:2:length(data_in)) = dd_out_vals;
|
||||
@@ -432,42 +416,103 @@ classdef EQ < handle
|
||||
end
|
||||
|
||||
output_vec(m) = e_dc + input_vec.'*coeff;
|
||||
y_raw = output_vec(m); % ungeweighteter Equalizer-Ausgang
|
||||
|
||||
if ~obj.load_decisions
|
||||
[~,dd_idx] = min(abs(output_vec(m) - constellation_in_)); % decision for closest constellation point
|
||||
dd_out(k) = constellation_in_(dd_idx);
|
||||
end
|
||||
|
||||
% ---------- WDFE / PDFE ----------
|
||||
fb_sym = dd_out(k);
|
||||
|
||||
if obj.weighted_DFE ~= 0
|
||||
% Get constellation
|
||||
const = obj.constellation_in;
|
||||
|
||||
% Half minimum symbol distance (for normalization of |x - xhat|)
|
||||
const_s = sort(const(:).');
|
||||
d = diff(const_s);
|
||||
dmin = min(d(d>0));
|
||||
halfStep = dmin/2;
|
||||
|
||||
% Reliability gamma_k
|
||||
if output_vec(m) > min(const) && output_vec(m) < max(const)
|
||||
gamma_k = 1 - abs(output_vec(m) - dd_out(k))/halfStep;
|
||||
gamma_k = max(0, min(1, gamma_k)); % clamp to [0,1]
|
||||
else
|
||||
gamma_k = 1;
|
||||
end
|
||||
|
||||
% f(gamma_k)
|
||||
if obj.weighted_DFE == 1
|
||||
switch obj.weighted_DFE_mode
|
||||
case 'R1'
|
||||
f_gamma_k = double(gamma_k >= obj.weighted_DFE_d_min);
|
||||
|
||||
case 'R2'
|
||||
f_gamma_k = gamma_k;
|
||||
|
||||
case 'I1'
|
||||
a_s = obj.weighted_DFE_I_mode(1);
|
||||
b_s = obj.weighted_DFE_I_mode(2);
|
||||
t = a_s*((gamma_k/b_s) - 1);
|
||||
f_gamma_k = 0.5*(tanh(t) + 1);
|
||||
|
||||
case 'I2'
|
||||
a_s = obj.weighted_DFE_I_mode(1);
|
||||
b_s = obj.weighted_DFE_I_mode(2);
|
||||
Imax = obj.weighted_DFE_I_mode(3);
|
||||
t = a_s*((gamma_k/b_s) - 1);
|
||||
f_gamma_k = (Imax/2)*(tanh(t) + 1);
|
||||
|
||||
otherwise
|
||||
error('Unknown weighted_DFE_mode');
|
||||
end
|
||||
|
||||
% Weighted decision
|
||||
xbar = f_gamma_k*dd_out(k) + (1 - f_gamma_k)*output_vec(m);
|
||||
|
||||
elseif obj.weighted_DFE == 2
|
||||
% PDFE
|
||||
xbar = obj.PDFE_coefficient*dd_out(k) + (1 - obj.PDFE_coefficient)*output_vec(m);
|
||||
end
|
||||
|
||||
output_vec_weighted(m) = xbar;
|
||||
fb_sym = xbar;
|
||||
output_vec(m) = xbar;
|
||||
end
|
||||
|
||||
if obj.Nb(1) > 0
|
||||
dd_DFE(2:end) = dd_DFE(1:end-1);
|
||||
dd_DFE(1) = dd_out(k);
|
||||
dd_DFE(1) = fb_sym;
|
||||
|
||||
if obj.ideal_dfe && m > obj.k0
|
||||
dd_DFE(1) = ref_in(m-obj.k0);
|
||||
end
|
||||
[D_2,D_3] = obj.calc_nl_vecs(dd_DFE,ind_mat_DFE_2nd,ind_mat_DFE_3rd,norm_fac_DFE2,norm_fac_DFE3,delta_DFE2,delta_DFE3,cplx);
|
||||
|
||||
[D_2,D_3] = obj.calc_nl_vecs(dd_DFE,ind_mat_DFE_2nd,ind_mat_DFE_3rd,...
|
||||
norm_fac_DFE2,norm_fac_DFE3,delta_DFE2,delta_DFE3,cplx);
|
||||
end
|
||||
|
||||
if obj.weighted_DFE ~= 0 && obj.weighted_error
|
||||
% Error weighted decision
|
||||
error = y_raw - output_vec(m);
|
||||
else
|
||||
% Error hard decision
|
||||
error = y_raw - dd_out(k);
|
||||
end
|
||||
% if dd_loop ~= 21
|
||||
error = output_vec(m) - dd_out(k);
|
||||
% else
|
||||
% error = 0;
|
||||
% end
|
||||
|
||||
coeff = coeff - mu_mat*error*conj(input_vec);
|
||||
% e_save(:,save_ind) = coeff;
|
||||
% save_ind = save_ind+1;
|
||||
|
||||
if 1%mu_mat ~= 0
|
||||
if 1 % mu_mat ~= 0
|
||||
e_dc = e_dc - obj.DCmu*error;
|
||||
% error_log(cnt,dd_loop) = e_dc;
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
%figure(2023);plot(error_log(:,1))
|
||||
% shifting the output sequence by k0 symbols
|
||||
yout = (circshift(output_vec.',-(obj.k0))).'; %(circshift(dd_out.',-(obj.k0))).';
|
||||
|
||||
@@ -536,12 +581,6 @@ classdef EQ < handle
|
||||
|
||||
% save frequency response to the work space
|
||||
if obj.save_taps
|
||||
% save the FFE coefficients to the work space
|
||||
% pathn = evalin('base','modeldir');
|
||||
% eval([obj.field_ffe, ' = obj.e ;']) ;
|
||||
% eval([obj.field_dfe, ' = b ;']) ;
|
||||
% eval(['save(''', pathn, '\',obj.filen,''', ''', obj.field_ffe,''', ''',obj.field_dfe,''') ;']) ;
|
||||
|
||||
save("coefficients",obj.e, obj.b);
|
||||
end
|
||||
|
||||
@@ -681,19 +720,11 @@ classdef EQ < handle
|
||||
|
||||
ind_mat_3rd2 = NaN(N3,3);
|
||||
count = 1;
|
||||
% for t = 1:Ne3
|
||||
% ind_mat_3rd2(count,:) = [t t t];
|
||||
% count = count + 1;
|
||||
% end
|
||||
for t = 1:Ne3
|
||||
% ind_mat_3rd2(count,:) = [t t t];
|
||||
% count = count + 1;
|
||||
for u = t:min(Ne3,t+len_3rd)
|
||||
for v = unique([t u])
|
||||
ind_mat_3rd2(count,:) = [t v u];
|
||||
count = count + 1;
|
||||
% ind_mat_3rd2(count,:) = [t u u];
|
||||
% count = count + 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -739,3 +770,6 @@ classdef EQ < handle
|
||||
end
|
||||
end
|
||||
|
||||
% References
|
||||
% [1] T. J. Wettlin, “Experimental Evaluation of Advanced Digital Signal Processing for Intra-Datacenter Systems using Direct-Detection,” 2023.
|
||||
% [Online]. Available: https://nbn-resolving.org/urn:nbn:de:gbv:8:3-2023-00703-8
|
||||
@@ -597,7 +597,7 @@ classdef ML_MLSE < handle
|
||||
obj.S = obj.nSym;
|
||||
obj.Nf = obj.order * obj.sps;
|
||||
obj.nStates = obj.S^obj.L;
|
||||
obj.nFeasible = obj.nStates * obj.S; %feasible state transitions
|
||||
obj.nFeasible = obj.nStates * obj.S;
|
||||
|
||||
% --- Trellis mapping
|
||||
obj.trellis_states = reshape(obj.constellation,1,[]);
|
||||
@@ -621,7 +621,8 @@ classdef ML_MLSE < handle
|
||||
|
||||
% --- Initialize weights
|
||||
if isempty(obj.w) || any(size(obj.w) ~= [obj.Nf+1,obj.nFeasible])
|
||||
obj.w = randn(obj.Nf+1,obj.nFeasible);
|
||||
% obj.w = randn(obj.Nf+1,obj.nFeasible);
|
||||
obj.w = zeros(obj.Nf+1,obj.nFeasible);
|
||||
end
|
||||
|
||||
% --- Fast lookup tables
|
||||
|
||||
525
Classes/04_DSP/Equalizer/ML_MLSE_GPU.m
Normal file
525
Classes/04_DSP/Equalizer/ML_MLSE_GPU.m
Normal file
@@ -0,0 +1,525 @@
|
||||
classdef ML_MLSE_GPU < handle
|
||||
% ---------------------------------------------------------------------
|
||||
% W. Lanneer and Y. Lefevre,
|
||||
% “Machine Learning-Based Pre-Equalizers for Maximum Likelihood
|
||||
% Sequence Estimation in High-Speed PONs,” EUSIPCO 2023
|
||||
% ---------------------------------------------------------------------
|
||||
% This implementation reproduces the closed-loop ML-based
|
||||
% pre-equalizer training for MLSE, supporting both training and
|
||||
% detection (decision-directed) modes.
|
||||
% ---------------------------------------------------------------------
|
||||
|
||||
properties
|
||||
sps
|
||||
order
|
||||
e
|
||||
e_tr
|
||||
error
|
||||
|
||||
len_tr
|
||||
mu_tr
|
||||
epochs_tr
|
||||
|
||||
dd_mode
|
||||
mu_dd
|
||||
epochs_dd
|
||||
|
||||
adaptive_mu
|
||||
|
||||
constellation
|
||||
L
|
||||
alpha
|
||||
DIR
|
||||
DIR_flip
|
||||
trellis_states
|
||||
traceback_depth
|
||||
delta
|
||||
|
||||
% --- New: GPU Support ---
|
||||
use_gpu
|
||||
|
||||
% Internal variables
|
||||
S
|
||||
Nf
|
||||
nStates
|
||||
nFeasible
|
||||
combs
|
||||
first_sym
|
||||
last_sym
|
||||
valid
|
||||
valid_to_idx
|
||||
valid_from_idx
|
||||
w
|
||||
|
||||
% Fast lookup
|
||||
nSym
|
||||
key_table
|
||||
trans_index
|
||||
true_to_state_idx
|
||||
|
||||
% Debug metrics
|
||||
ber = []
|
||||
ce = ones(1,1)
|
||||
end
|
||||
|
||||
methods
|
||||
function obj = ML_MLSE_GPU(options)
|
||||
arguments(Input)
|
||||
options.sps = 2;
|
||||
options.order = 15;
|
||||
options.len_tr = 4096;
|
||||
options.mu_tr = 0.001;
|
||||
options.epochs_tr = 5;
|
||||
options.dd_mode = 1;
|
||||
options.mu_dd = 1e-5;
|
||||
options.epochs_dd = 5;
|
||||
options.adaptive_mu = 1;
|
||||
options.delta = 0;
|
||||
options.traceback_depth = 1024;
|
||||
options.L = 1;
|
||||
options.use_gpu = 0; % Default: CPU
|
||||
end
|
||||
|
||||
fn = fieldnames(options);
|
||||
for n = 1:numel(fn)
|
||||
obj.(fn{n}) = options.(fn{n});
|
||||
end
|
||||
|
||||
% Check GPU availability
|
||||
if obj.use_gpu
|
||||
if gpuDeviceCount() > 0
|
||||
% GPU is available, keeping use_gpu = 1
|
||||
else
|
||||
warning('GPU requested but not available. Falling back to CPU.');
|
||||
obj.use_gpu = 0;
|
||||
end
|
||||
end
|
||||
|
||||
obj.e = zeros(obj.order,1);
|
||||
obj.error = 0;
|
||||
end
|
||||
|
||||
% ==============================================================
|
||||
% PROCESS
|
||||
% ==============================================================
|
||||
function [X,X_viterbi] = process(obj, X, D)
|
||||
% Normalize input RMS
|
||||
X = X.normalize("mode","rms");
|
||||
obj.constellation = sort(unique(D.signal),'ascend');
|
||||
obj.nSym = numel(obj.constellation);
|
||||
|
||||
if length(X)/length(D) ~= obj.sps
|
||||
warning('Signal length does not fit to reference!');
|
||||
end
|
||||
|
||||
% --- Parameters
|
||||
obj.S = obj.nSym;
|
||||
obj.Nf = obj.order * obj.sps;
|
||||
obj.nStates = obj.S^obj.L;
|
||||
obj.nFeasible = obj.nStates * obj.S;
|
||||
|
||||
% --- Trellis mapping
|
||||
obj.trellis_states = reshape(obj.constellation,1,[]);
|
||||
pre_comb_mat = repmat(obj.trellis_states, obj.L, 1);
|
||||
pre_comb_cell = mat2cell(pre_comb_mat, ones(1,obj.L), size(pre_comb_mat,2));
|
||||
obj.combs = fliplr(combvec(pre_comb_cell{:}).');
|
||||
obj.first_sym = obj.combs(:,1);
|
||||
obj.last_sym = obj.combs(:,end);
|
||||
obj.nStates = size(obj.combs,1);
|
||||
|
||||
% --- Valid transitions
|
||||
obj.valid = false(obj.nStates);
|
||||
for from = 1:obj.nStates
|
||||
for to = 1:obj.nStates
|
||||
if all(obj.combs(to,2:end) == obj.combs(from,1:end-1))
|
||||
obj.valid(to,from) = true;
|
||||
end
|
||||
end
|
||||
end
|
||||
[obj.valid_to_idx,obj.valid_from_idx] = find(obj.valid);
|
||||
|
||||
% --- Initialize weights
|
||||
if isempty(obj.w) || any(size(obj.w) ~= [obj.Nf+1,obj.nFeasible])
|
||||
obj.w = randn(obj.Nf+1,obj.nFeasible);
|
||||
obj.w = zeros(obj.Nf+1,obj.nFeasible);
|
||||
end
|
||||
|
||||
% --- Fast lookup tables
|
||||
[~, sym_idx_mat] = ismember(obj.combs, obj.constellation);
|
||||
key_vals = 1 + sum((sym_idx_mat - 1) .* (obj.nSym .^ (0:obj.L-1)), 2);
|
||||
max_key = obj.nSym^obj.L;
|
||||
obj.key_table = zeros(max_key,1,'uint32');
|
||||
obj.key_table(key_vals) = 1:obj.nStates;
|
||||
|
||||
obj.trans_index = sparse(obj.nStates,obj.nStates);
|
||||
for i = 1:length(obj.valid_from_idx)
|
||||
f = obj.valid_from_idx(i);
|
||||
t = obj.valid_to_idx(i);
|
||||
obj.trans_index(t,f) = i;
|
||||
end
|
||||
|
||||
% ==============================================================
|
||||
% TRAINING
|
||||
% ==============================================================
|
||||
fprintf('\n--- Training mode ---\n');
|
||||
% Always run training on CPU to avoid loop latency on GPU
|
||||
obj.equalize(X.signal, D.signal, obj.mu_tr, obj.epochs_tr, obj.len_tr, true);
|
||||
obj.e_tr = obj.e;
|
||||
|
||||
% ==============================================================
|
||||
% DECISION-DIRECTED / TESTING
|
||||
% ==============================================================
|
||||
fprintf('--- Decision-directed / detection mode ---\n');
|
||||
|
||||
x_sig = X.signal;
|
||||
d_sig = D.signal;
|
||||
|
||||
% Move to GPU only for inference if requested
|
||||
if obj.use_gpu
|
||||
try
|
||||
x_sig = gpuArray(single(x_sig));
|
||||
if isa(obj.w, 'double')
|
||||
obj.w = gpuArray(single(obj.w));
|
||||
end
|
||||
catch
|
||||
warning('Failed to move data to GPU. Falling back to CPU.');
|
||||
obj.use_gpu = 0;
|
||||
end
|
||||
end
|
||||
|
||||
[y, y_vit] = obj.equalize(x_sig, d_sig, obj.mu_dd, obj.epochs_dd, X.length, false);
|
||||
|
||||
% Gather results back to CPU
|
||||
if obj.use_gpu
|
||||
y = gather(y);
|
||||
y_vit = gather(y_vit);
|
||||
obj.w = gather(obj.w);
|
||||
end
|
||||
|
||||
X_viterbi = X;
|
||||
X.signal = y;
|
||||
X_viterbi.signal = y_vit;
|
||||
end
|
||||
|
||||
% ==============================================================
|
||||
% EQUALIZE
|
||||
% ==============================================================
|
||||
function [y,y_ref] = equalize(obj,x,d,mu,epochs,N,training)
|
||||
debug = 1;
|
||||
showPlots = 1;
|
||||
|
||||
% Ensure basic types
|
||||
if obj.use_gpu && ~isa(x, 'gpuArray') && training % Only force gpu for training if desired, but here we focus on inference
|
||||
% For training, we keep existing flow for now.
|
||||
end
|
||||
|
||||
y = zeros(N,1);
|
||||
% On GPU, y should be gpuArray if we build it there, but we return it at the end.
|
||||
if obj.use_gpu && ~training
|
||||
y = gpuArray.zeros(N,1);
|
||||
end
|
||||
|
||||
nSymbols = ceil(N/obj.sps);
|
||||
|
||||
for epoch = 1:epochs
|
||||
pm = zeros(obj.nStates,1);
|
||||
pred = zeros(nSymbols,obj.nStates,'uint32');
|
||||
% pred is large uint32, GPU support for uint32 exists but sometimes limited.
|
||||
% We'll keep pred on CPU for Viterbi path storage or gather per chunk if needed.
|
||||
|
||||
pm_sto = nan(obj.nStates,nSymbols,'like',pm);
|
||||
CE_accum = 0;
|
||||
|
||||
start_sample = 1;
|
||||
end_sample = N;
|
||||
start_symbol = 1 + floor((start_sample - 1)/obj.sps);
|
||||
|
||||
% --- initialize true state
|
||||
if numel(d) >= obj.L && start_symbol >= obj.L
|
||||
init_seq = d(start_symbol-obj.L+1:start_symbol);
|
||||
key_init = obj.seq2key(init_seq);
|
||||
true_to_state_idx = obj.key_table(key_init);
|
||||
if true_to_state_idx==0, true_to_state_idx=1; end
|
||||
else
|
||||
true_to_state_idx = uint32(1);
|
||||
end
|
||||
|
||||
% =========================================================
|
||||
% INFERENCE OPTIMIZATION (Vectorized Branch Metrics)
|
||||
% =========================================================
|
||||
run_vectorized = ~training && obj.use_gpu;
|
||||
|
||||
% --- Pre-calculate symbol indices for fast key generation (Training Only)
|
||||
% This avoids slow ismember() calls inside the loop
|
||||
d_indices = [];
|
||||
if training
|
||||
% Map d to 0..M-1 indices once
|
||||
[~, d_indices] = ismember(d, obj.constellation);
|
||||
d_indices = d_indices - 1; % 0-based
|
||||
end
|
||||
|
||||
if run_vectorized
|
||||
% 1. Construct Sliding Window Input Matrix
|
||||
% Windows corresponding to symbol centers: start_sample:sps:end_sample
|
||||
% Each window is [x(sample-Nf+1+delta : sample+delta); 1]
|
||||
|
||||
% Create index matrix
|
||||
num_syms = numel(start_sample:obj.sps:end_sample);
|
||||
samples_idx = start_sample + (0:num_syms-1)*obj.sps; % [1 x nSymbols]
|
||||
|
||||
% Indices for window: relative -Nf+1+delta to +delta
|
||||
rel_idx = (-obj.Nf + 1 + obj.delta : obj.delta)'; % [Nf x 1]
|
||||
|
||||
% Full index matrix (implicit expansion)
|
||||
idx_mat = rel_idx + samples_idx; % [Nf x nSymbols]
|
||||
|
||||
% Handle boundary padding (clamping indices)
|
||||
% Since x is gpuArray, indexing with clamp is efficient if rewritten
|
||||
% But MATLAB indexing x(idx_mat) with OOB indices is tricky vectorized.
|
||||
% Faster approach: Clamp indices to [1, length(x)] and mask zero-pads.
|
||||
|
||||
mask_valid = (idx_mat >= 1) & (idx_mat <= length(x));
|
||||
idx_clamped = max(1, min(length(x), idx_mat));
|
||||
|
||||
X_windows = x(idx_clamped); % [Nf x nSymbols]
|
||||
X_windows = X_windows .* mask_valid; % Zero pad out-of-bounds
|
||||
|
||||
% Add bias row
|
||||
X_windows = [X_windows; ones(1, num_syms, 'like', x)]; % [(Nf+1) x nSymbols]
|
||||
|
||||
% 2. Bulk Compute Branch Metrics
|
||||
% C_all: [nFeasible x nSymbols] = ( [(Nf+1) x nFeasible] )' * [(Nf+1) x nSymbols]
|
||||
% obj.w usually (Nf+1)xFeasible
|
||||
C_all = obj.w' * X_windows;
|
||||
|
||||
% 3. Bring Metrics to CPU for Viterbi
|
||||
% Processing Viterbi on CPU is often faster than serial kernel launches on GPU
|
||||
C_all_cpu = gather(C_all);
|
||||
|
||||
% Pre-computation done. Now loop for Viterbi (Add-Compare-Select)
|
||||
|
||||
% Prepare CPU variables
|
||||
pm = gather(pm);
|
||||
pm_sto = gather(pm_sto);
|
||||
pred = gather(pred);
|
||||
v_tilde_mat = inf(obj.nStates, obj.nStates);
|
||||
|
||||
% Loop over symbols (pure CPU Viterbi)
|
||||
for sym_i = 1:num_syms
|
||||
% Current branch metrics for all edges
|
||||
c_hat_curr = C_all_cpu(:, sym_i); % [nFeasible x 1]
|
||||
|
||||
% ACS Update
|
||||
pm = pm - min(pm);
|
||||
v_tilde = pm(obj.valid_from_idx) + c_hat_curr;
|
||||
|
||||
v_tilde_mat(obj.valid) = v_tilde;
|
||||
[pm_next, pred(sym_i,:)] = min(v_tilde_mat, [], 2);
|
||||
|
||||
pm_next = pm_next - min(pm_next);
|
||||
pm = pm_next;
|
||||
pm_sto(:,sym_i) = pm;
|
||||
end
|
||||
|
||||
symbol = num_syms; % Update for traceback
|
||||
|
||||
else
|
||||
% =========================================================
|
||||
% STANDARD SEQUENTIAL LOOP (Training / CPU Inference)
|
||||
% =========================================================
|
||||
pow_vec = (obj.nSym .^ (0:obj.L-1)).'; % Pre-calc powers for keygen
|
||||
|
||||
for sample = start_sample:obj.sps:end_sample
|
||||
symbol = (sample - start_sample)/obj.sps + 1;
|
||||
sym_idx = start_symbol + (symbol - 1);
|
||||
|
||||
% --- Observation window (with delta)
|
||||
i1 = sample - obj.Nf + 1 + obj.delta;
|
||||
i2 = sample + obj.delta;
|
||||
buf = x(max(1,i1):min(length(x),i2));
|
||||
padL = max(0,1 - i1);
|
||||
padR = max(0,i2 - length(x));
|
||||
yk = [zeros(padL,1); buf(:); zeros(padR,1)];
|
||||
yk = [yk;1];
|
||||
|
||||
% --- Branch metrics
|
||||
c_hat = (yk.' * obj.w).';
|
||||
pm = pm - min(pm);
|
||||
v_tilde = pm(obj.valid_from_idx) + c_hat;
|
||||
|
||||
% --- allocate once
|
||||
if epoch==1 && symbol==1
|
||||
obj.true_to_state_idx = ones(ceil(N/obj.sps),1,'uint32');
|
||||
end
|
||||
|
||||
% --- previous "to" becomes "from"
|
||||
if symbol>1
|
||||
true_from_state_idx = obj.true_to_state_idx(symbol-1);
|
||||
else
|
||||
true_from_state_idx = 1;
|
||||
end
|
||||
|
||||
% --- compute or reuse "to" state
|
||||
if epoch==1
|
||||
if sym_idx>=obj.L
|
||||
% OPTIMIZED KEY GENERATION: Use pre-calculated indices
|
||||
% key_to = obj.seq2key(d(sym_idx-obj.L+1:sym_idx));
|
||||
|
||||
% Extract subsequence of indices (flip needed as per seq2key logic?)
|
||||
% seq2key does: ismember(flip(seq)...).
|
||||
% d_indices is 0-based index of d.
|
||||
% We want indices of d(sym_idx-obj.L+1 : sym_idx)
|
||||
|
||||
d_sub = d_indices(sym_idx-obj.L+1 : sym_idx);
|
||||
% seq2key flips the sequence.
|
||||
% So we need to efficiently calculate scalar key from d_sub.
|
||||
% key = 1 + sum( flip(d_sub) .* pow );
|
||||
% Let's do it manually to be fast
|
||||
|
||||
key_to = 1 + sum(flip(d_sub) .* pow_vec);
|
||||
|
||||
state_idx = obj.key_table(key_to);
|
||||
if state_idx==0
|
||||
state_idx = true_from_state_idx;
|
||||
end
|
||||
obj.true_to_state_idx(symbol) = state_idx;
|
||||
else
|
||||
obj.true_to_state_idx(symbol) = true_from_state_idx;
|
||||
end
|
||||
end
|
||||
true_to_state_idx = obj.true_to_state_idx(symbol);
|
||||
|
||||
% --- fast Dirac creation
|
||||
dirac = zeros(obj.nFeasible,1,'like',x); % inherit type (gpu or cpu)
|
||||
trans_idx = obj.trans_index(true_to_state_idx,true_from_state_idx);
|
||||
if trans_idx~=0
|
||||
dirac(trans_idx)=1;
|
||||
end
|
||||
|
||||
% --- ensure valid (from,to)
|
||||
if ~any(dirac)
|
||||
mask = obj.valid_from_idx==true_from_state_idx & ...
|
||||
obj.valid_to_idx ==true_to_state_idx;
|
||||
if any(mask)
|
||||
dirac(mask) = 1;
|
||||
else
|
||||
idx = find(obj.valid_from_idx==true_from_state_idx,1,'first');
|
||||
dirac(idx) = 1;
|
||||
obj.true_to_state_idx(symbol) = obj.valid_to_idx(idx);
|
||||
end
|
||||
end
|
||||
|
||||
% ===================================================================
|
||||
% TRAINING MODE (weight update)
|
||||
% ===================================================================
|
||||
if training
|
||||
% --- Softmax and CE
|
||||
v_shift = -(v_tilde - min(v_tilde));
|
||||
v_shift = min(v_shift,100);
|
||||
expv = exp(v_shift);
|
||||
p = expv./(sum(expv)+eps);
|
||||
CE_symbol(symbol) = -log(p(dirac==1)+eps);
|
||||
|
||||
% --- CE smoothing and adaptive μ
|
||||
if sym_idx>obj.L
|
||||
CE_smooth(symbol)=0.01*CE_symbol(symbol)+0.99*CE_symbol(symbol-1);
|
||||
else
|
||||
CE_smooth(symbol)=CE_symbol(symbol);
|
||||
end
|
||||
CE_accum=CE_accum+CE_symbol(symbol);
|
||||
|
||||
% --- Gradient update
|
||||
dmp=(dirac-p)';
|
||||
dL_Dw=(yk).*dmp;
|
||||
if sym_idx>=obj.L
|
||||
if obj.adaptive_mu
|
||||
mu_eff=CE_smooth(symbol);
|
||||
mu_eff=max(min(mu_eff,0.2),1e-4);
|
||||
else
|
||||
mu_eff=mu;
|
||||
end
|
||||
obj.w=obj.w - mu_eff.*dL_Dw;
|
||||
end
|
||||
end
|
||||
|
||||
% ===================================================================
|
||||
% DECODING MODE (Viterbi only)
|
||||
% ===================================================================
|
||||
% Compare-Select (always executed)
|
||||
vmat=inf(obj.nStates,obj.nStates);
|
||||
vmat(obj.valid)=v_tilde;
|
||||
[pm_next,pred(symbol,:)]=min(vmat,[],2);
|
||||
pm_next=pm_next-min(pm_next);
|
||||
pm=pm_next;
|
||||
pm_sto(:,symbol)=pm;
|
||||
end
|
||||
end
|
||||
|
||||
% --- Traceback
|
||||
[~,s_end]=min(pm);
|
||||
vpath=zeros(symbol,1,'uint32');
|
||||
vpath(symbol)=s_end;
|
||||
for n=symbol:-1:2
|
||||
vpath(n-1)=pred(n,vpath(n));
|
||||
end
|
||||
|
||||
y_ref=d(start_symbol:end);
|
||||
y=obj.first_sym(vpath);
|
||||
|
||||
% --- BER/CE reporting and plots
|
||||
if training
|
||||
err=sum(y~=y_ref(1:length(y)));
|
||||
ser=err/length(y);
|
||||
try
|
||||
ref_bits=PAMmapper(obj.S,0).demap(y_ref(1:length(y)));
|
||||
eq_bits=PAMmapper(obj.S,0).demap(y);
|
||||
[~,~,ber,~]=calc_ber(ref_bits,eq_bits,"skip_front",10,"skip_end",10,"returnErrorLocation",1);
|
||||
fprintf('Epoch %d - BER: %.2e\n',epoch,ber);
|
||||
obj.ber(epoch)=ber;
|
||||
catch
|
||||
fprintf('Epoch %d - SER: %.2e\n',epoch,ser);
|
||||
obj.ber(epoch)=ser;
|
||||
end
|
||||
obj.ce(epoch)=CE_accum/symbol;
|
||||
|
||||
if debug && mod(epoch,10)==1 && showPlots
|
||||
figure(10);clf
|
||||
subplot(3,2,1:2);
|
||||
if obj.use_gpu, wm=gather(obj.w); else, wm=obj.w; end
|
||||
imagesc(wm);axis xy;colorbar;title('Filter W');
|
||||
subplot(3,2,3);
|
||||
vtilde_mat=NaN(obj.nStates,obj.nStates);
|
||||
vtilde_mat(obj.valid)=gather(v_tilde); % gather just in case
|
||||
imagesc(vtilde_mat);axis xy;colorbar;title('Path Metrics (v\_tilde)');
|
||||
subplot(3,2,4);
|
||||
plot(1:symbol,gather(pm_sto));title('Path Metric Evolution');
|
||||
subplot(3,2,5);hold on;
|
||||
scatter(1:symbol,CE_symbol,1,'.');
|
||||
scatter(1:symbol,CE_smooth,1,'.');
|
||||
title('Cross Entropy');
|
||||
subplot(3,2,6);hold on;
|
||||
yyaxis left
|
||||
scatter(1:length(obj.ce),obj.ce,10,'s','filled');
|
||||
ylabel('Cross Entropy');
|
||||
yyaxis right
|
||||
scatter(1:length(obj.ber),obj.ber,10,'d','filled');
|
||||
set(gca,'YScale','log');
|
||||
ylabel('BER (log)');
|
||||
xlabel('Epoch');grid on;
|
||||
title('Convergence');
|
||||
drawnow;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% ==============================================================
|
||||
% Helper: Sequence → key (always scalar)
|
||||
% ==============================================================
|
||||
function key = seq2key(obj, seq)
|
||||
[~, idx] = ismember(flip(seq), obj.constellation);
|
||||
pow = (obj.nSym .^ (0:obj.L-1)).';
|
||||
key = 1 + sum((idx(:) - 1) .* pow);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,7 @@
|
||||
classdef Timing_Recovery < handle
|
||||
|
||||
properties(Access=public)
|
||||
modulation
|
||||
timing_error_detector
|
||||
sps
|
||||
damping_factor
|
||||
@@ -12,6 +13,7 @@ classdef Timing_Recovery < handle
|
||||
function obj = Timing_Recovery(options)
|
||||
arguments(Input)
|
||||
|
||||
options.modulation = 'PAM/PSK/QAM'
|
||||
options.timing_error_detector = 'Gardner';
|
||||
options.sps = 2;
|
||||
options.damping_factor = 1.0;
|
||||
@@ -32,6 +34,7 @@ classdef Timing_Recovery < handle
|
||||
function [data_out,timing_error] = process(obj, data_in)
|
||||
|
||||
timing_synchronization = comm.SymbolSynchronizer( ...
|
||||
"Modulation", obj.modulation, ...
|
||||
"TimingErrorDetector", obj.timing_error_detector, ...
|
||||
"SamplesPerSymbol", obj.sps, ...
|
||||
"DampingFactor", obj.damping_factor, ...
|
||||
|
||||
@@ -21,14 +21,12 @@ classdef DBHandler < handle
|
||||
% obj = DBHandler('pathToDB', 'path/to/database.db');
|
||||
|
||||
arguments
|
||||
options.dataBase = ""; % Default value for pathToDB if not provided
|
||||
options.dataBase = "labor_highspeed"; % Default value for pathToDB if not provided
|
||||
options.type = "mysql";
|
||||
options.server = "";
|
||||
options.server = "134.245.243.254";
|
||||
options.port = 3306;
|
||||
options.user = "";
|
||||
options.password = "";
|
||||
|
||||
|
||||
options.user = "silas";
|
||||
options.password = "silas";
|
||||
end
|
||||
|
||||
% Assign values to class properties based on input arguments
|
||||
|
||||
@@ -7,11 +7,11 @@ classdef Metricstruct
|
||||
eqParam_id (1,1) double {mustBeNumeric} = NaN
|
||||
date_of_processing (1,1) datetime = datetime('now')
|
||||
|
||||
numBits (1,1) double {mustBeInteger, mustBeNonnegative} = 0
|
||||
BER (1,1) double {mustBeNumeric, mustBeNonnegative} = 0
|
||||
numBitErr (1,1) double {mustBeInteger, mustBeNonnegative} = 0
|
||||
BER_precoded (1,1) double {mustBeNumeric, mustBeNonnegative} = 0
|
||||
numBitErr_precoded (1,1) double {mustBeInteger, mustBeNonnegative} = 0
|
||||
numBits (1,1) double = 0
|
||||
BER (1,1) double = 0
|
||||
numBitErr (1,1) double = 0
|
||||
BER_precoded (1,1) double = 0
|
||||
numBitErr_precoded (1,1) double = 0
|
||||
|
||||
SNR (1,1) double {mustBeNumeric} = NaN
|
||||
SNR_level (:,1) double {mustBeNumeric} = []
|
||||
|
||||
8
Datatypes/db_decoder.m
Normal file
8
Datatypes/db_decoder.m
Normal file
@@ -0,0 +1,8 @@
|
||||
classdef db_decoder < int32
|
||||
|
||||
enumeration
|
||||
sequencedetection (0) % use MLSE for decoding
|
||||
memoryless (1) % use modulo
|
||||
end
|
||||
|
||||
end
|
||||
@@ -23,7 +23,7 @@ try
|
||||
|
||||
if options.mode == "load_run_id" || options.append_to_db
|
||||
% Initialize database connection
|
||||
database = DBHandler("dataBase", [options.dataBase], "type", options.database_type );
|
||||
database = DBHandler("dataBase", [options.dataBase], "type", options.database_type, 'user',"silas","password","silas","server","134.245.243.254");
|
||||
|
||||
if 0
|
||||
% 2. Check if an equalizer configuration with the same hash exists
|
||||
@@ -95,7 +95,7 @@ try
|
||||
adaption= 1;
|
||||
use_dd_mode = 1;
|
||||
|
||||
use_ffe = 1;
|
||||
use_ffe = 0;
|
||||
use_dfe = 0;
|
||||
use_vnle_mlse = 0;
|
||||
use_dbtgt = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function [db_results] = duobinary_target(eq_, mlse_,M, rx_signal, tx_symbols, tx_bits, options)
|
||||
|
||||
arguments
|
||||
arguments
|
||||
eq_
|
||||
mlse_
|
||||
M
|
||||
@@ -11,125 +11,143 @@ arguments
|
||||
options.showAnalysis = 0;
|
||||
options.eth_style_symbol_mapping = 0;
|
||||
options.postFFE = [];
|
||||
end
|
||||
options.decoding_mode db_decoder = db_decoder.sequencedetection;
|
||||
end
|
||||
|
||||
%Duobinary Targeting
|
||||
db_ref_sequence = Duobinary().encode(tx_symbols);
|
||||
db_ref_constellation = unique(db_ref_sequence.signal);
|
||||
[eq_signal, eq_noise] = eq_.process(rx_signal,db_ref_sequence);
|
||||
|
||||
if ~isempty(options.postFFE)
|
||||
%Duobinary Targeting
|
||||
db_ref_sequence = Duobinary().encode(tx_symbols);
|
||||
db_ref_constellation = unique(db_ref_sequence.signal);
|
||||
[eq_signal, eq_noise] = eq_.process(rx_signal,db_ref_sequence);
|
||||
|
||||
if ~isempty(options.postFFE)
|
||||
[eq_signal,eq_noise] = options.postFFE.process(eq_signal,db_ref_sequence);
|
||||
end
|
||||
end
|
||||
%
|
||||
|
||||
mlse_.DIR = [1,1];
|
||||
%
|
||||
switch options.decoding_mode
|
||||
case db_decoder.sequencedetection %MLSE
|
||||
mlse_.DIR = [1,1];
|
||||
if isa(mlse_,'MLSE_viterbi')
|
||||
pam_sig_sd = mlse_.process(eq_signal);
|
||||
else
|
||||
[pam_sig_sd,LLR,GMI_MLSE] = mlse_.process(eq_signal,tx_symbols);
|
||||
end
|
||||
pam_sig_hd = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).quantize(pam_sig_sd);
|
||||
case db_decoder.memoryless %DB Target FFE
|
||||
% Hard decision on FFE output
|
||||
eq_signal_hd = PAMmapper(M, 0).quantize(eq_signal,'custom_const',db_ref_constellation.');
|
||||
eq_signal_hd = Duobinary().decode(eq_signal_hd);
|
||||
pam_sig_hd = eq_signal_hd;
|
||||
end
|
||||
|
||||
if isa(mlse_,'MLSE_viterbi')
|
||||
mlse_sig_sd = mlse_.process(eq_signal);
|
||||
else
|
||||
[mlse_sig_sd,LLR,GMI_MLSE] = mlse_.process(eq_signal,tx_symbols);
|
||||
end
|
||||
|
||||
mlse_sig_hd = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).quantize(mlse_sig_sd);
|
||||
|
||||
% precoding to mitigate error propagation, most prominently used in
|
||||
% combination with duobinary signaling to avoid catastrophic error
|
||||
% behavior (see J.W.M. Bergmans, Digital Baseband Transmission and Recording -> partial response signaling)
|
||||
switch options.precode_mode
|
||||
% precoding to mitigate error propagation, most prominently used in
|
||||
% combination with duobinary signaling to avoid catastrophic error
|
||||
% behavior (see J.W.M. Bergmans, Digital Baseband Transmission and Recording -> partial response signaling)
|
||||
switch options.precode_mode
|
||||
|
||||
case db_mode.no_db
|
||||
% TX Data is not precoded:
|
||||
|
||||
% A) Emulate diff precoding
|
||||
mlse_sig_hd_precoded = Duobinary().encode(mlse_sig_hd,"M",M);
|
||||
mlse_sig_hd_precoded = Duobinary().decode(mlse_sig_hd_precoded,"M",M);
|
||||
if options.decoding_mode == db_decoder.sequencedetection
|
||||
pam_sig_hd_precoded = Duobinary().encode(pam_sig_hd,"M",M);
|
||||
pam_sig_hd_precoded = Duobinary().decode(pam_sig_hd_precoded,"M",M);
|
||||
else
|
||||
pam_sig_hd_precoded = pam_sig_hd;
|
||||
end
|
||||
|
||||
tx_symbols_precoded = Duobinary().encode(tx_symbols);
|
||||
tx_symbols_precoded = Duobinary().decode(tx_symbols_precoded);
|
||||
|
||||
tx_bits_precoded = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(tx_symbols_precoded);
|
||||
rx_bits_mlse = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(mlse_sig_hd_precoded);
|
||||
|
||||
[~,errors_db_diff_precoded,ber_db_diff_precoded,~] = calc_ber(rx_bits_mlse.signal,tx_bits_precoded.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
rx_bits_mlse = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(pam_sig_hd_precoded);
|
||||
|
||||
[bits_db,errors_db_diff_precoded,ber_db_diff_precoded,~] = calc_ber(rx_bits_mlse.signal,tx_bits_precoded.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
|
||||
%B) Just determine BER
|
||||
rx_bits_mlse = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(mlse_sig_hd);
|
||||
if options.decoding_mode == db_decoder.sequencedetection
|
||||
rx_bits_mlse = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(pam_sig_hd);
|
||||
tx_bits = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(tx_symbols);
|
||||
[bits_mlse,errors_mlse,ber_db,~] = calc_ber(rx_bits_mlse.signal,tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
else
|
||||
ber_db = NaN;
|
||||
errors_db = NaN;
|
||||
end
|
||||
|
||||
case db_mode.db_precoded
|
||||
|
||||
% Daten SIND TATSÄCHLICH precoded auf TX Seite:
|
||||
|
||||
% A) Decode at Rx if no DB targeting was applied (we are in VNLE or MLSE EQ structure here!
|
||||
mlse_sig_hd_decoded = Duobinary().encode(mlse_sig_hd,"M",M);
|
||||
mlse_sig_hd_decoded = Duobinary().decode(mlse_sig_hd_decoded,"M",M);
|
||||
rx_bits_mlse_decoded = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(mlse_sig_hd_decoded);
|
||||
[~,errors_db_diff_precoded,ber_db_diff_precoded,a] = calc_ber(rx_bits_mlse_decoded.signal,tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
burst_db_precoded = count_error_bursts(a, 40);
|
||||
% B) Omit the Coding by comparing with demapped TX symbol sequence
|
||||
if options.decoding_mode == db_decoder.sequencedetection
|
||||
pam_sig_hd_decoded = Duobinary().encode(pam_sig_hd,"M",M);
|
||||
pam_sig_hd_decoded = Duobinary().decode(pam_sig_hd_decoded,"M",M);
|
||||
else
|
||||
pam_sig_hd_decoded = pam_sig_hd;
|
||||
end
|
||||
|
||||
rx_bits_mlse_decoded = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(pam_sig_hd_decoded);
|
||||
[bits_db,errors_db_diff_precoded,ber_db_diff_precoded,a] = calc_ber(rx_bits_mlse_decoded.signal,tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
burst_db_precoded = count_error_bursts(a, 40);
|
||||
|
||||
% B) Omit the Coding by comparing with demapped TX symbol sequence
|
||||
if options.decoding_mode == db_decoder.sequencedetection
|
||||
tx_bits = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(tx_symbols);
|
||||
rx_bits_mlse = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(mlse_sig_hd);
|
||||
rx_bits_mlse = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(pam_sig_hd);
|
||||
[bits_db,errors_db,ber_db,a] = calc_ber(rx_bits_mlse.signal,tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
burst_db = count_error_bursts(a, 40);
|
||||
|
||||
cols = linspecer(8);
|
||||
figure();hold on;
|
||||
stem(1:40,burst_db,'LineWidth',1,'Color',cols(4,:),'Marker','_','DisplayName','w/o diff. precoder');
|
||||
stem(1:40,burst_db_precoded,'LineWidth',1,'Color',cols(3,:),'Marker','.','LineStyle','-','DisplayName','w diff. precoder');
|
||||
xlabel('Bit Error Burst Length')
|
||||
ylabel('Occurence')
|
||||
set(gca, 'yscale', 'log');
|
||||
end
|
||||
|
||||
% M = numel(unique(tx_symbols.signal));
|
||||
rx_bits = PAMmapper(M,0,"eth_style",options.eth_style_symbol_mapping).demap(mlse_sig_hd);
|
||||
|
||||
[bits_db,errors_db,ber_db,errorIndice_db] = calc_ber(rx_bits.signal,tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||
else
|
||||
ber_db = NaN;
|
||||
errors_db = NaN;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
alpha = arburg(eq_noise.signal,1);%pf_.coefficients(2);
|
||||
alpha = alpha(2);
|
||||
if isa(mlse_,'MLSE_viterbi')
|
||||
switch options.decoding_mode
|
||||
case db_decoder.sequencedetection %MLSE
|
||||
if isa(mlse_,'MLSE_viterbi')
|
||||
gmi_mlse = NaN;
|
||||
air_mlse = NaN;
|
||||
else
|
||||
else
|
||||
gmi_mlse = GMI_MLSE;
|
||||
air_mlse = tx_symbols.fs .* floor(log2(double(M))*10)/10 .* gmi_mlse ./ log2(double(M));
|
||||
end
|
||||
end
|
||||
case db_decoder.memoryless %DB Target FFE
|
||||
% [gmi] = calc_air(eq_signal_sd, tx_symbols, "skip_front", 10000, "skip_end", 10000);
|
||||
[gmi] = calc_ngmi(eq_signal,tx_symbols);
|
||||
gmi_mlse = NaN;
|
||||
air_mlse = NaN;
|
||||
end
|
||||
|
||||
db_results = struct();
|
||||
db_results.metrics = Metricstruct;
|
||||
db_results.metrics.result_id = NaN;
|
||||
db_results.metrics.run_id = NaN;
|
||||
db_results.metrics.eqParam_id = NaN;
|
||||
db_results.metrics.date_of_processing = datetime('now');
|
||||
db_results.metrics.BER = ber_db;
|
||||
db_results.metrics.numBits = bits_db;
|
||||
db_results.metrics.numBitErr = errors_db;
|
||||
db_results.metrics.BER_precoded = ber_db_diff_precoded;
|
||||
db_results.metrics.numBitErr_precoded = errors_db_diff_precoded;
|
||||
db_results.metrics.GMI = gmi_mlse;
|
||||
db_results.metrics.AIR = air_mlse;
|
||||
db_results.metrics.MLSE_dir = mlse_.DIR;
|
||||
db_results.metrics.Alpha = alpha;
|
||||
db_results = struct();
|
||||
db_results.metrics = Metricstruct;
|
||||
db_results.metrics.result_id = NaN;
|
||||
db_results.metrics.run_id = NaN;
|
||||
db_results.metrics.eqParam_id = NaN;
|
||||
db_results.metrics.date_of_processing = datetime('now');
|
||||
db_results.metrics.BER = ber_db;
|
||||
db_results.metrics.numBits = bits_db;
|
||||
db_results.metrics.numBitErr = errors_db;
|
||||
db_results.metrics.BER_precoded = ber_db_diff_precoded;
|
||||
db_results.metrics.numBitErr_precoded = errors_db_diff_precoded;
|
||||
db_results.metrics.GMI = gmi_mlse;
|
||||
db_results.metrics.AIR = air_mlse;
|
||||
db_results.metrics.MLSE_dir = mlse_.DIR;
|
||||
db_results.metrics.Alpha = NaN;
|
||||
|
||||
% Create DB results structure
|
||||
db_results.config = Equalizerstruct();
|
||||
eq_.e = [];
|
||||
eq_.e2 = [];
|
||||
eq_.e3 = [];
|
||||
db_results.config.eq = jsonencode(eq_);
|
||||
% mlse_.DIR = [];
|
||||
db_results.config.mlse = jsonencode(mlse_);
|
||||
db_results.config.equalizer_structure = int32(equalizer_structure.vnle_db_mlse);
|
||||
db_results.config.comment = 'function: Duobinary tgt. (VNLE -> MLSE)';
|
||||
% Create DB results structure
|
||||
db_results.config = Equalizerstruct();
|
||||
eq_.e = [];
|
||||
eq_.e2 = [];
|
||||
eq_.e3 = [];
|
||||
db_results.config.eq = jsonencode(eq_);
|
||||
% mlse_.DIR = [];
|
||||
db_results.config.mlse = jsonencode(mlse_);
|
||||
db_results.config.equalizer_structure = int32(equalizer_structure.vnle_db_mlse);
|
||||
db_results.config.comment = 'function: Duobinary tgt. (VNLE -> MLSE)';
|
||||
|
||||
if options.showAnalysis
|
||||
if options.showAnalysis
|
||||
|
||||
eq_signal.eye(eq_signal.fs,M,"fignum",249);
|
||||
|
||||
@@ -147,7 +165,7 @@ if options.showAnalysis
|
||||
figure(341); clf;
|
||||
showLevelHistogram(eq_signal, db_ref_sequence, "fignum", 341);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -101,11 +101,11 @@ switch precode_mode
|
||||
tx_bits_precoded = mapper.demap(tx_symbols_precoded);
|
||||
|
||||
rx_bits = mapper.demap(eq_signal_hd_precoded);
|
||||
[~, errors_precoded, ber_precoded, ~] = calc_ber(rx_bits.signal, tx_bits_precoded.signal, "skip_front", 30000, "skip_end", 150, "returnErrorLocation", 1);
|
||||
[~, errors_precoded, ber_precoded, ~] = calc_ber(rx_bits.signal, tx_bits_precoded.signal, "skip_front", 150, "skip_end", 150, "returnErrorLocation", 1);
|
||||
|
||||
% B) Just determine BER
|
||||
rx_bits = mapper.demap(eq_signal_hd);
|
||||
[bits, errors, ber, error_pos] = calc_ber(rx_bits.signal, tx_bits.signal, "skip_front", 30000, "skip_end", 150, "returnErrorLocation", 1);
|
||||
[bits, errors, ber, error_pos] = calc_ber(rx_bits.signal, tx_bits.signal, "skip_front", 150, "skip_end", 150, "returnErrorLocation", 1);
|
||||
|
||||
case db_mode.db_precoded
|
||||
% Data is precoded on TX side
|
||||
|
||||
@@ -19,7 +19,7 @@ errorIndice= [];
|
||||
|
||||
if length(data_ref) == length(data_in)
|
||||
|
||||
bits = numel(data_in(:,options.skip_front+1:end));
|
||||
bits = numel(data_in);
|
||||
|
||||
if options.returnErrorLocation == 0
|
||||
errors = sum( data_in ~= data_ref,"all" );
|
||||
|
||||
1
Functions/Theory/Dissertation/PD/100ghz_pd.json
Normal file
1
Functions/Theory/Dissertation/PD/100ghz_pd.json
Normal file
File diff suppressed because one or more lines are too long
1094
Functions/Theory/Dissertation/PD/100ghz_pd_bandwidth.csv
Normal file
1094
Functions/Theory/Dissertation/PD/100ghz_pd_bandwidth.csv
Normal file
File diff suppressed because it is too large
Load Diff
189
Functions/Theory/Dissertation/PD/100ghz_pd_responsivity.csv
Normal file
189
Functions/Theory/Dissertation/PD/100ghz_pd_responsivity.csv
Normal file
@@ -0,0 +1,189 @@
|
||||
1271; 0,3822390561953123
|
||||
1271,5; 0,38419930758242105
|
||||
1272; 0,3863702270698115
|
||||
1272,5; 0,38866381361008207
|
||||
1273; 0,3879395121421424
|
||||
1273,5; 0,3908144071258651
|
||||
1274; 0,38941324484667683
|
||||
1274,5; 0,3886482390643653
|
||||
1275; 0,3871744844466787
|
||||
1275,5; 0,3819131706099883
|
||||
1276; 0,3825696588771148
|
||||
1276,5; 0,38164278490690173
|
||||
1277; 0,3793811681135283
|
||||
1277,5; 0,3810969321121832
|
||||
1278; 0,38561783928242943
|
||||
1278,5; 0,38908016962932246
|
||||
1279; 0,3960805723111348
|
||||
1279,5; 0,39776514973186317
|
||||
1280; 0,3983882080762364
|
||||
1280,5; 0,3989277489532531
|
||||
1281; 0,3953941895319796
|
||||
1281,5; 0,39648781234375075
|
||||
1282; 0,3966742531971841
|
||||
1282,5; 0,4002652938704556
|
||||
1283; 0,40694867274287283
|
||||
1283,5; 0,41253621540584107
|
||||
1284; 0,42331258033724095
|
||||
1284,5; 0,43077624043193397
|
||||
1285; 0,4393232961230962
|
||||
1285,5; 0,44562110387213405
|
||||
1286; 0,4486108628977331
|
||||
1286,5; 0,4511055411347422
|
||||
1287; 0,4470620968166301
|
||||
1287,5; 0,4429754327671611
|
||||
1288; 0,4369760292430348
|
||||
1288,5; 0,4313232143283202
|
||||
1289; 0,4297225921323986
|
||||
1289,5; 0,42752981686391456
|
||||
1290; 0,42755873451486015
|
||||
1290,5; 0,42838607683209784
|
||||
1291; 0,4301647938813945
|
||||
1291,5; 0,430252773791754
|
||||
1292; 0,42983642955282675
|
||||
1292,5; 0,43082456782130385
|
||||
1293; 0,43010358194135434
|
||||
1293,5; 0,4286564203011507
|
||||
1294; 0,427551350387675
|
||||
1294,5; 0,4262216680056993
|
||||
1295; 0,4248061879636029
|
||||
1295,5; 0,42323824957412115
|
||||
1296; 0,42606502803639024
|
||||
1296,5; 0,42771450181627213
|
||||
1297; 0,4321631047010831
|
||||
1297,5; 0,43498514011363654
|
||||
1298; 0,43784261304613636
|
||||
1298,5; 0,4407749972159394
|
||||
1299; 0,4418422146980885
|
||||
1299,5; 0,44599734720216344
|
||||
1300; 0,44682291369874283
|
||||
1300,5; 0,44591438239702175
|
||||
1301; 0,4467439544276042
|
||||
1301,5; 0,4476723529309602
|
||||
1302; 0,44945964164622887
|
||||
1302,5; 0,451298649370644
|
||||
1303; 0,4555133819899133
|
||||
1303,5; 0,45932593779132214
|
||||
1304; 0,4641282326427819
|
||||
1304,5; 0,4660504121662704
|
||||
1305; 0,4672659916854359
|
||||
1305,5; 0,46826040808978875
|
||||
1306; 0,4672565627341473
|
||||
1306,5; 0,46494462666243797
|
||||
1307; 0,4614228682537902
|
||||
1307,5; 0,4594403315234107
|
||||
1308; 0,4567366055619595
|
||||
1308,5; 0,4543323943556662
|
||||
1309; 0,4531865329043713
|
||||
1309,5; 0,4531463334993213
|
||||
1310; 0,4549753124500232
|
||||
1310,5; 0,4563928182609638
|
||||
1311; 0,45807413408326114
|
||||
1311,5; 0,46008646903182826
|
||||
1312; 0,4625724677767604
|
||||
1312,5; 0,4642585362150724
|
||||
1313; 0,46443821082811676
|
||||
1313,5; 0,46431357981151344
|
||||
1314; 0,46266595309664715
|
||||
1314,5; 0,4634382042743632
|
||||
1315; 0,46336655819789074
|
||||
1315,5; 0,46220084770212755
|
||||
1316; 0,4621345192553813
|
||||
1316,5; 0,4619581088515051
|
||||
1317; 0,4622449432593938
|
||||
1317,5; 0,4634433901557192
|
||||
1318; 0,46570049058443497
|
||||
1318,5; 0,46746148714378144
|
||||
1319; 0,47051648811702607
|
||||
1319,5; 0,4736426053778652
|
||||
1320; 0,4752061192279773
|
||||
1320,5; 0,47672990706900487
|
||||
1321; 0,4792517016402914
|
||||
1321,5; 0,4804619217778243
|
||||
1322; 0,48045944968999643
|
||||
1322,5; 0,48044446341935276
|
||||
1323; 0,48033475585370833
|
||||
1323,5; 0,48149717921878865
|
||||
1324; 0,4825722899403748
|
||||
1324,5; 0,4815908698039817
|
||||
1325; 0,47971434550698255
|
||||
1325,5; 0,47939560128213987
|
||||
1326; 0,47928833048577313
|
||||
1326,5; 0,4780400467999897
|
||||
1327; 0,47648974188994153
|
||||
1327,5; 0,47504778426945493
|
||||
1328; 0,4767823647690562
|
||||
1328,5; 0,4796497575996306
|
||||
1329; 0,48149796255153543
|
||||
1329,5; 0,48293054311361827
|
||||
1330; 0,48577046817752123
|
||||
1330,5; 0,4879484457550308
|
||||
1331; 0,4890100791953129
|
||||
1331,5; 0,49009094527466934
|
||||
1332; 0,49064503921138825
|
||||
1332,5; 0,4912120163422964
|
||||
1333; 0,49112778494545795
|
||||
1333,5; 0,49082017761106833
|
||||
1334; 0,4891140575382411
|
||||
1334,5; 0,48897830241499407
|
||||
1335; 0,49041975188209885
|
||||
1335,5; 0,49289447360952865
|
||||
1336; 0,4941116428265213
|
||||
1336,5; 0,49433827868707936
|
||||
1337; 0,49545156946075475
|
||||
1337,5; 0,4964012858510567
|
||||
1338; 0,4976037918135337
|
||||
1338,5; 0,4975359556660308
|
||||
1339; 0,49750995144010873
|
||||
1339,5; 0,4979126497053521
|
||||
1340; 0,497475232138574
|
||||
1340,5; 0,49759401707965406
|
||||
1341; 0,4969075828334858
|
||||
1341,5; 0,49790859550840155
|
||||
1342; 0,4995926776094223
|
||||
1342,5; 0,5020720343160757
|
||||
1343; 0,5055918669106463
|
||||
1343,5; 0,5084877122557891
|
||||
1344; 0,5109238856077332
|
||||
1344,5; 0,5133476480224053
|
||||
1345; 0,5141099804906323
|
||||
1345,5; 0,5128794457064829
|
||||
1346; 0,5123127905211531
|
||||
1346,5; 0,5113593533744085
|
||||
1347; 0,5104375198088649
|
||||
1347,5; 0,5085465423276292
|
||||
1348; 0,5051624771364174
|
||||
1348,5; 0,5027410542553522
|
||||
1349; 0,5024260057256427
|
||||
1349,5; 0,5006762680057522
|
||||
1350; 0,4993251970666754
|
||||
1350,5; 0,49851742723413256
|
||||
1351; 0,4997497443709538
|
||||
1351,5; 0,5007398590455319
|
||||
1352; 0,5007983935913018
|
||||
1352,5; 0,49955251820707475
|
||||
1353; 0,4995544623158038
|
||||
1353,5; 0,5007503896118954
|
||||
1354; 0,500737054751544
|
||||
1354,5; 0,5007708386435341
|
||||
1355; 0,49980743334640554
|
||||
1355,5; 0,49964682618339445
|
||||
1356; 0,5007641635781113
|
||||
1356,5; 0,5010692724813779
|
||||
1357; 0,5017795860327432
|
||||
1357,5; 0,5018051896000885
|
||||
1358; 0,5018027877181053
|
||||
1358,5; 0,5024950398138555
|
||||
1359; 0,5037205512345401
|
||||
1359,5; 0,503981020991427
|
||||
1360; 0,50290329982148
|
||||
1360,5; 0,5017820667010949
|
||||
1361; 0,5029651424174117
|
||||
1361,5; 0,5021824944534237
|
||||
1362; 0,5007892395452416
|
||||
1362,5; 0,4997500743708827
|
||||
1363; 0,5006844796799776
|
||||
1363,5; 0,5020955167671433
|
||||
1364; 0,5059166193037108
|
||||
1364,5; 0,5043160514940865
|
||||
1365; 0,4996516521717823
|
||||
|
1
Functions/Theory/Dissertation/PD/70ghz_pd.json
Normal file
1
Functions/Theory/Dissertation/PD/70ghz_pd.json
Normal file
File diff suppressed because one or more lines are too long
336
Functions/Theory/Dissertation/PD/70ghz_pd_bandwidth.csv
Normal file
336
Functions/Theory/Dissertation/PD/70ghz_pd_bandwidth.csv
Normal file
@@ -0,0 +1,336 @@
|
||||
-7,105427357601002e-15; -0,20522295068752294
|
||||
0,19999999999999574; -0,030254119194939477
|
||||
0,39999999999998437; -0,06262230958084825
|
||||
0,5999999999999943; -0,044750988038462225
|
||||
0,79999999999999; -0,010697832675218066
|
||||
0,9999999999999929; -0,007716070877040071
|
||||
1,1999999999999886; -0,0034636603575668445
|
||||
1,3999999999999915; -0,0031910951680633737
|
||||
1,5999999999999943; -0,018902533473217353
|
||||
1,79999999999999; -0,053402356238265725
|
||||
1,9999999999999858; -0,016020039340308045
|
||||
2,1999999999999957; -0,03803455116762944
|
||||
2,3999999999999915; -0,027441706124275544
|
||||
2,5999999999999943; -0,011772163020613569
|
||||
2,799999999999997; -0,009307744420832709
|
||||
2,999999999999993; -0,004522003719798828
|
||||
3,1999999999999957; -0,004428713345979496
|
||||
3,3999999999999986; -0,004366538233070205
|
||||
3,6000000000000014; -0,004332966081604717
|
||||
3,8000000000000043; -0,004325484592115458
|
||||
3,999999999999993; -0,00434158146513397
|
||||
4,200000000000003; -0,004378744401192236
|
||||
4,3999999999999915; -0,004434461100823572
|
||||
4,599999999999994; -0,004506219264559075
|
||||
4,800000000000004; -0,004691539083670371
|
||||
5; -0,003991004145723398
|
||||
5,200000000000003; -0,003246645775397461
|
||||
5,3999999999999915; -0,0037896250865734338
|
||||
5,599999999999994; -0,023040865733948923
|
||||
5,799999999999997; -0,01989208568211387
|
||||
5,999999999999993; -0,0010096736725997424
|
||||
6,199999999999996; -0,013640471154773515
|
||||
6,399999999999999; -0,022016055829107817
|
||||
6,599999999999994; -0,02380673595648508
|
||||
6,799999999999997; -0,010201242210113204
|
||||
7; -0,004611668103098321
|
||||
7,200000000000003; -0,006761186983221812
|
||||
7,399999999999999; -0,014690649105665976
|
||||
7,600000000000001; -0,00390457347586759
|
||||
7,799999999999997; -0,045710767178201106
|
||||
8; -0,051072792534853306
|
||||
8,199999999999996; -0,07115209529133537
|
||||
8,399999999999991; -0,08208254896261469
|
||||
8,599999999999994; -0,03145294469160209
|
||||
8,799999999999997; -0,05983935104068827
|
||||
8,999999999999993; -0,03242609227466575
|
||||
9,199999999999996; -0,08006336213732856
|
||||
9,399999999999999; -0,07616115793078393
|
||||
9,599999999999994; -0,06914618045986609
|
||||
9,79999999999999; -0,0980170516533656
|
||||
9,999999999999979; -0,09444267414680585
|
||||
10,199999999999996; -0,1296597291950028
|
||||
10,399999999999999; -0,11722924677565816
|
||||
10,599999999999987; -0,1261332014641745
|
||||
10,799999999999983; -0,14295450195563753
|
||||
10,999999999999986; -0,13583779081780678
|
||||
11,199999999999989; -0,13655730701500968
|
||||
11,399999999999991; -0,1528394332576566
|
||||
11,59999999999998; -0,1455635480829094
|
||||
11,799999999999983; -0,15279717820688443
|
||||
11,999999999999986; -0,10865677433838528
|
||||
12,199999999999982; -0,08239755649864788
|
||||
12,39999999999997; -0,09832039720463737
|
||||
12,59999999999998; -0,09759344817184923
|
||||
12,799999999999983; -0,08609094120940997
|
||||
12,999999999999986; -0,13125303885294937
|
||||
13,199999999999982; -0,17127202835872835
|
||||
13,399999999999977; -0,17693756228526825
|
||||
13,599999999999987; -0,17588170560175698
|
||||
13,799999999999976; -0,21097131291045912
|
||||
13,999999999999979; -0,19723442280681303
|
||||
14,199999999999974; -0,17157649801758756
|
||||
14,399999999999977; -0,18397126413186138
|
||||
14,599999999999973; -0,22900338921732688
|
||||
14,799999999999969; -0,2093816161727191
|
||||
14,999999999999972; -0,19030766934459553
|
||||
15,199999999999974; -0,1930304944542227
|
||||
15,39999999999997; -0,16656555782418714
|
||||
15,599999999999959; -0,17578057654064638
|
||||
15,799999999999962; -0,18022738188194465
|
||||
15,999999999999964; -0,20411747466271102
|
||||
16,199999999999967; -0,24005694593094873
|
||||
16,39999999999997; -0,2409966294337953
|
||||
16,59999999999996; -0,23769655914941312
|
||||
16,79999999999996; -0,2461254200795704
|
||||
16,999999999999964; -0,18731174872333556
|
||||
17,199999999999967; -0,2088294036646947
|
||||
17,39999999999997; -0,26222359684914354
|
||||
17,59999999999996; -0,2627551021676209
|
||||
17,799999999999976; -0,23263650093640598
|
||||
17,99999999999995; -0,25096659518845055
|
||||
18,199999999999967; -0,28136295333973704
|
||||
18,399999999999956; -0,26386838346721
|
||||
18,599999999999945; -0,2697397873853724
|
||||
18,79999999999996; -0,27151761208872793
|
||||
18,99999999999995; -0,30006432628995094
|
||||
19,199999999999953; -0,32687710754417765
|
||||
19,39999999999997; -0,34133822014109505
|
||||
19,599999999999945; -0,35107178825199314
|
||||
19,79999999999996; -0,3207896032858475
|
||||
19,999999999999964; -0,3126066108279488
|
||||
20,199999999999953; -0,3015988268627865
|
||||
20,399999999999956; -0,32309268875395514
|
||||
20,59999999999996; -0,29037807883314093
|
||||
20,79999999999996; -0,2922929925308506
|
||||
20,99999999999995; -0,34985423889611633
|
||||
21,199999999999953; -0,36118780832491426
|
||||
21,399999999999956; -0,3251998242712628
|
||||
21,599999999999945; -0,2462767056035915
|
||||
21,799999999999933; -0,24441110825428503
|
||||
21,99999999999995; -0,2563960865160375
|
||||
22,19999999999994; -0,2437759650962339
|
||||
22,399999999999956; -0,22035942863831393
|
||||
22,59999999999996; -0,18593789159821306
|
||||
22,799999999999947; -0,1580165418909094
|
||||
22,99999999999995; -0,16755721915183486
|
||||
23,19999999999994; -0,20252844881319776
|
||||
23,399999999999913; -0,22661159302112166
|
||||
23,599999999999945; -0,24267584629923267
|
||||
23,799999999999933; -0,29043098079506846
|
||||
23,999999999999936; -0,32759458048731993
|
||||
24,19999999999994; -0,35261052927411507
|
||||
24,39999999999994; -0,4205920563168606
|
||||
24,599999999999945; -0,40505099517955756
|
||||
24,799999999999947; -0,39978925053876324
|
||||
24,999999999999936; -0,4143117703519099
|
||||
25,19999999999994; -0,4219338489372779
|
||||
25,399999999999928; -0,4610014796748456
|
||||
25,59999999999993; -0,47018850098853804
|
||||
25,799999999999947; -0,4491839028784197
|
||||
25,999999999999936; -0,4458017205576206
|
||||
26,199999999999925; -0,5003597628349712
|
||||
26,39999999999994; -0,5150256066968306
|
||||
26,599999999999916; -0,5045451019191436
|
||||
26,799999999999933; -0,5133285112874519
|
||||
26,999999999999922; -0,527155709897416
|
||||
27,19999999999994; -0,5140685424201781
|
||||
27,399999999999928; -0,49851201964752834
|
||||
27,599999999999916; -0,5137853037079538
|
||||
27,79999999999992; -0,5372179267072128
|
||||
27,999999999999936; -0,5680498018750453
|
||||
28,199999999999925; -0,5098792124208722
|
||||
28,399999999999928; -0,5261932637134765
|
||||
28,59999999999993; -0,5420533092094892
|
||||
28,799999999999933; -0,5905815675266202
|
||||
28,999999999999936; -0,6278889530493021
|
||||
29,19999999999991; -0,6751232569663901
|
||||
29,399999999999913; -0,6417648030574505
|
||||
29,599999999999916; -0,6296852646307589
|
||||
29,79999999999992; -0,6731708512242238
|
||||
29,999999999999908; -0,6766999836256802
|
||||
30,199999999999925; -0,6439858043186271
|
||||
30,399999999999928; -0,6626801183278261
|
||||
30,599999999999916; -0,6575261415486628
|
||||
30,79999999999992; -0,5997705615017357
|
||||
30,999999999999908; -0,5811412251277055
|
||||
31,19999999999994; -0,6232767821070331
|
||||
31,399999999999913; -0,6936652252154754
|
||||
31,599999999999902; -0,7251977840976562
|
||||
31,79999999999992; -0,756817987398668
|
||||
31,999999999999908; -0,7626095276161258
|
||||
32,199999999999925; -0,6998981751538662
|
||||
32,39999999999991; -0,6934363825152801
|
||||
32,599999999999916; -0,7182913332333944
|
||||
32,79999999999992; -0,6821687933338616
|
||||
32,99999999999992; -0,6663845829793131
|
||||
33,19999999999991; -0,6790941839387248
|
||||
33,399999999999956; -0,7261666896639514
|
||||
33,59999999999993; -0,7451168856292525
|
||||
33,79999999999995; -0,7934809742704192
|
||||
33,999999999999936; -0,7510223153439268
|
||||
34,19999999999994; -0,7443418303903386
|
||||
34,39999999999994; -0,7371085317015025
|
||||
34,599999999999945; -0,7272823230638554
|
||||
34,79999999999995; -0,7718051044043159
|
||||
34,99999999999995; -0,8073906768142964
|
||||
35,19999999999994; -0,7385956882940454
|
||||
35,399999999999956; -0,7160082880884686
|
||||
35,59999999999996; -0,7288095360695297
|
||||
35,79999999999996; -0,7236002865254121
|
||||
35,999999999999964; -0,7334442970172868
|
||||
36,19999999999997; -0,8346252066934827
|
||||
36,39999999999997; -0,8358944542314521
|
||||
36,59999999999996; -0,8009380638643022
|
||||
36,79999999999995; -0,7673865510270743
|
||||
36,99999999999998; -0,7199971905956084
|
||||
37,19999999999997; -0,7007463840971893
|
||||
37,399999999999984; -0,7387659310023729
|
||||
37,59999999999997; -0,721690739663293
|
||||
37,799999999999976; -0,657816129243038
|
||||
37,999999999999964; -0,6495576293842058
|
||||
38,20000000000001; -0,6597731574058532
|
||||
38,399999999999984; -0,672563855947323
|
||||
38,6; -0,6904033318178788
|
||||
38,79999999999999; -0,689336430830561
|
||||
39,00000000000002; -0,6117300762411118
|
||||
39,199999999999996; -0,5639205810793819
|
||||
39,40000000000001; -0,5983607766144563
|
||||
39,6; -0,5559212159038944
|
||||
39,80000000000002; -0,42213980065065204
|
||||
40,00000000000001; -0,41577016450588733
|
||||
40,20000000000004; -0,41077502582773695
|
||||
40,40000000000001; -0,4494641339488026
|
||||
40,600000000000044; -0,5314018055872878
|
||||
40,80000000000002; -0,641785834906464
|
||||
41,00000000000005; -0,7108648438969745
|
||||
41,200000000000024; -0,6859741311599707
|
||||
41,400000000000055; -0,7017068191441105
|
||||
41,60000000000003; -0,6791477498478518
|
||||
41,80000000000005; -0,653540590898162
|
||||
42,00000000000005; -0,6660836110606962
|
||||
42,20000000000007; -0,6129974635842999
|
||||
42,400000000000055; -0,5886674503992548
|
||||
42,60000000000007; -0,5864375705241724
|
||||
42,80000000000006; -0,5934101604542863
|
||||
43,000000000000064; -0,5971640717600168
|
||||
43,20000000000005; -0,687945370263789
|
||||
43,400000000000084; -0,826010895068702
|
||||
43,60000000000007; -0,8402202033545532
|
||||
43,80000000000009; -0,8155286496095027
|
||||
44,00000000000008; -0,7732529679765467
|
||||
44,20000000000008; -0,7804047850500297
|
||||
44,400000000000084; -0,7186911944635885
|
||||
44,6000000000001; -0,6952708619187691
|
||||
44,80000000000009; -0,6796908471847463
|
||||
45,00000000000011; -0,6791911674601883
|
||||
45,20000000000008; -0,750294196595163
|
||||
45,400000000000084; -0,8751930740148532
|
||||
45,6000000000001; -0,9276382447045544
|
||||
45,800000000000104; -0,9719742530818682
|
||||
46,00000000000011; -1,036079323202311
|
||||
46,20000000000011; -1,1181471052790317
|
||||
46,4000000000001; -1,0958490215727856
|
||||
46,60000000000013; -1,0625635604160188
|
||||
46,80000000000012; -1,0681184335495777
|
||||
47,00000000000011; -1,0491794786564261
|
||||
47,20000000000011; -1,0004949273189419
|
||||
47,40000000000013; -1,0264013117471569
|
||||
47,600000000000115; -0,9884102239645856
|
||||
47,80000000000013; -0,9894223247725593
|
||||
48,00000000000012; -1,0796700017398213
|
||||
48,20000000000014; -1,099628578912291
|
||||
48,40000000000011; -0,9509643943244526
|
||||
48,60000000000016; -0,9037231717547249
|
||||
48,80000000000013; -0,8528339219613446
|
||||
49,000000000000135; -0,858999004045224
|
||||
49,20000000000014; -0,9168300378510152
|
||||
49,400000000000155; -0,9577590379052632
|
||||
49,60000000000013; -0,999788695384078
|
||||
49,80000000000016; -1,0093627559760772
|
||||
50,00000000000015; -1,0138490875975479
|
||||
50,200000000000166; -1,0664495148931095
|
||||
50,400000000000155; -1,2154632152797502
|
||||
50,60000000000017; -1,1788818515429793
|
||||
50,800000000000146; -1,050269845638372
|
||||
51,00000000000019; -1,0622383145312964
|
||||
51,200000000000166; -1,1841450735158365
|
||||
51,4000000000002; -1,139376215918372
|
||||
51,60000000000017; -1,119440531745798
|
||||
51,8000000000002; -1,187468605994586
|
||||
52,00000000000018; -1,1953550362808736
|
||||
52,20000000000021; -1,269604124857581
|
||||
52,40000000000018; -1,3849421747096078
|
||||
52,6000000000002; -1,3718481353189649
|
||||
52,80000000000019; -1,3954600140641764
|
||||
53,00000000000022; -1,3942562465749204
|
||||
53,20000000000021; -1,4042931940245014
|
||||
53,400000000000226; -1,3795400304760106
|
||||
53,600000000000215; -1,4371475323268652
|
||||
53,80000000000023; -1,4680470055475139
|
||||
54,00000000000022; -1,4956152610708555
|
||||
54,20000000000024; -1,4599173760734971
|
||||
54,400000000000226; -1,3804207925357423
|
||||
54,60000000000023; -1,4209447553401664
|
||||
54,80000000000023; -1,4696589593832408
|
||||
55,00000000000025; -1,3473971465483299
|
||||
55,20000000000024; -1,2804811618109628
|
||||
55,40000000000024; -1,1931187716667573
|
||||
55,60000000000023; -1,1499753811035252
|
||||
55,80000000000026; -1,1787726888220313
|
||||
56,000000000000234; -1,1932811246412953
|
||||
56,20000000000025; -1,259756294621234
|
||||
56,40000000000024; -1,2340584671567725
|
||||
56,60000000000027; -1,1917426282230785
|
||||
56,800000000000246; -1,2255018834858493
|
||||
57,00000000000026; -1,2903085954845714
|
||||
57,200000000000266; -1,3799715177434764
|
||||
57,40000000000027; -1,4961435623060653
|
||||
57,60000000000026; -1,5184418601914111
|
||||
57,800000000000274; -1,4156967177433764
|
||||
58,00000000000025; -1,4701539637874377
|
||||
58,200000000000266; -1,545782763600434
|
||||
58,40000000000027; -1,5486404166502283
|
||||
58,600000000000286; -1,607511180291636
|
||||
58,80000000000026; -1,5918971528251729
|
||||
59,00000000000028; -1,7420918696456886
|
||||
59,20000000000028; -1,8688832280161232
|
||||
59,4000000000003; -1,9018553915656242
|
||||
59,600000000000286; -1,9313949044976835
|
||||
59,8000000000003; -1,7488759443354804
|
||||
60,000000000000306; -1,5879219632492743
|
||||
60,20000000000031; -1,5322688722554756
|
||||
60,40000000000028; -1,4779441671503282
|
||||
60,600000000000314; -1,3053954056727393
|
||||
60,8000000000003; -1,161200232220056
|
||||
61,00000000000032; -1,0852609076693227
|
||||
61,20000000000031; -1,039861302109443
|
||||
61,400000000000325; -1,0938817679702129
|
||||
61,600000000000314; -1,2827795990288489
|
||||
61,80000000000032; -1,4418988356213176
|
||||
62,000000000000306; -1,4887272875332065
|
||||
62,20000000000034; -1,3858016155912871
|
||||
62,400000000000325; -1,4386165299344782
|
||||
62,60000000000034; -1,623474266607849
|
||||
62,800000000000345; -1,6269465129654068
|
||||
63,00000000000035; -1,4835041232913464
|
||||
63,20000000000034; -1,4192369875578938
|
||||
63,40000000000037; -1,393348402668435
|
||||
63,60000000000036; -1,46529616679921
|
||||
63,800000000000374; -1,500508185495117
|
||||
64,00000000000037; -1,6190473360126991
|
||||
64,20000000000036; -1,7519875508476201
|
||||
64,40000000000035; -1,7562809083561022
|
||||
64,60000000000036; -1,969973816098435
|
||||
64,80000000000035; -2,0604805496803844
|
||||
65,00000000000037; -2,0818983868245247
|
||||
65,20000000000036; -2,096459467198311
|
||||
65,40000000000038; -2,2014641556121233
|
||||
65,60000000000039; -1,996828898735267
|
||||
65,80000000000038; -1,6692235197112448
|
||||
66,00000000000037; -1,4111710117485514
|
||||
66,20000000000039; -1,4616886686912545
|
||||
66,40000000000038; -1,6079210184093582
|
||||
66,60000000000039; -1,5839852165659427
|
||||
66,80000000000038; -1,583493358599156
|
||||
67,0000000000004; -1,3918025284299995
|
||||
|
166
Functions/Theory/Dissertation/PD/70ghz_pd_responsivity.csv
Normal file
166
Functions/Theory/Dissertation/PD/70ghz_pd_responsivity.csv
Normal file
@@ -0,0 +1,166 @@
|
||||
1270,8549581839902; 0,5258998226950353
|
||||
1270,743369175627; 0,5221430916732335
|
||||
1271,0781362007167; 0,5309982433674809
|
||||
1271,3013142174432; 0,5350233123194115
|
||||
1271,5244922341694; 0,5385117054110848
|
||||
1271,747670250896; 0,5428051122931441
|
||||
1271,9708482676224; 0,5468301812450749
|
||||
1272,305615292712; 0,5498713444532002
|
||||
1272,9751493428912; 0,5484402088258471
|
||||
1273,5330943847073; 0,5470985191752036
|
||||
1273,7562724014335; 0,5441468019437876
|
||||
1273,867861409797; 0,5398533950617284
|
||||
1274,0910394265231; 0,5377066916206987
|
||||
1274,3142174432496; 0,5337710686454775
|
||||
1274,8721624850657; 0,5309982433674809
|
||||
1275,4301075268816; 0,526615390508712
|
||||
1276,0996415770608; 0,5275098502758077
|
||||
1276,76917562724; 0,5296565537168374
|
||||
1277,4387096774192; 0,5305510134839331
|
||||
1278,1082437275984; 0,5325188249715436
|
||||
1278,7777777777776; 0,5350233123194115
|
||||
1279,4473118279568; 0,5344866364591541
|
||||
1280,116845878136; 0,5348444203659923
|
||||
1280,674790919952; 0,5369016778303125
|
||||
1281,1211469534048; 0,5409267467822432
|
||||
1281,5675029868578; 0,5438784640136589
|
||||
1281,790681003584; 0,5465618433149462
|
||||
1282,0510553564316; 0,5502291283600385
|
||||
1282,5718040621266; 0,554701427195517
|
||||
1283,2413381123058; 0,5545225352420978
|
||||
1283,910872162485; 0,553449183521583
|
||||
1284,5804062126642; 0,5489768846861045
|
||||
1285,13835125448; 0,5454884915944312
|
||||
1285,6962962962962; 0,5425367743630154
|
||||
1286,2542413381123; 0,5422684364328867
|
||||
1286,8121863799283; 0,5459357214779792
|
||||
1287,3701314217442; 0,5495135605463619
|
||||
1287,7792911190759; 0,553449183521583
|
||||
1288,0396654719234; 0,557832036380352
|
||||
1288,2628434886499; 0,5615887674021538
|
||||
1288,4860215053764; 0,5653454984239559
|
||||
1288,7463958582237; 0,5695494593293056
|
||||
1289,1555555555556; 0,5742006501182033
|
||||
1289,7135005973714; 0,5784940570002626
|
||||
1290,3830346475506; 0,5781362730934243
|
||||
1290,9409796893667; 0,5752740018387181
|
||||
1291,1641577060932; 0,57071225702653
|
||||
1291,3873357228194; 0,5672238639348568
|
||||
1291,610513739546; 0,5640038087733122
|
||||
1291,9452807646355; 0,5606048616583486
|
||||
1292,5032258064516; 0,555953670869451
|
||||
1293,0611708482675; 0,554701427195517
|
||||
1293,7307048984467; 0,5570270225899658
|
||||
1294,2886499402628; 0,5586370501707381
|
||||
1294,8465949820788; 0,5618571053322825
|
||||
1295,4045400238947; 0,5645404846335697
|
||||
1295,9624850657108; 0,5672238639348568
|
||||
1296,63201911589; 0,5672238639348568
|
||||
1297,3015531660692; 0,5654349444006653
|
||||
1297,9710872162484; 0,5627515650993782
|
||||
1298,6406212664276; 0,5614993214254442
|
||||
1299,3101553166068; 0,5625726731459592
|
||||
1299,979689366786; 0,5640038087733122
|
||||
1300,6492234169652; 0,5656138363540846
|
||||
1301,3187574671445; 0,5656138363540846
|
||||
1301,9882915173237; 0,5652560524472463
|
||||
1302,6578255675029; 0,5618571053322825
|
||||
1303,327359617682; 0,5584581582173189
|
||||
1303,9968936678613; 0,5563114547762892
|
||||
1304,6664277180405; 0,5543436432886787
|
||||
1305,3359617682197; 0,5539858593818404
|
||||
1305,8939068100358; 0,555953670869451
|
||||
1306,3402628434885; 0,5589053881008668
|
||||
1306,7866188769412; 0,56239378119254
|
||||
1307,2329749103942; 0,5656138363540846
|
||||
1307,679330943847; 0,5693705673758864
|
||||
1308,237275985663; 0,5722328386305927
|
||||
1308,9068100358422; 0,5713383788634969
|
||||
1309,464755077658; 0,5691022294457577
|
||||
1309,911111111111; 0,5658821742842133
|
||||
1310,3574671445638; 0,5634671329130548
|
||||
1310,8038231780165; 0,560515415681639
|
||||
1311,3617682198326; 0,5579214823570615
|
||||
1312,0313022700118; 0,5582792662638998
|
||||
1312,700836320191; 0,5604259697049294
|
||||
1313,3703703703702; 0,5627515650993782
|
||||
1313,9283154121863; 0,5645404846335697
|
||||
1314,374671445639; 0,5674922018649855
|
||||
1315,1557945041816; 0,5704439190964012
|
||||
1315,8253285543608; 0,5708017030032395
|
||||
1316,49486260454; 0,5715172708169162
|
||||
1317,1643966547192; 0,5722328386305927
|
||||
1317,8339307048984; 0,5727695144908501
|
||||
1318,5034647550776; 0,5715172708169162
|
||||
1319,1729988052568; 0,5711594869100779
|
||||
1319,842532855436; 0,5693705673758864
|
||||
1320,5120669056153; 0,5693705673758864
|
||||
1321,1816009557945; 0,5686549995622099
|
||||
1321,8511350059737; 0,5679394317485333
|
||||
1322,5206690561529; 0,5650771604938272
|
||||
1323,190203106332; 0,5645404846335697
|
||||
1323,8597371565113; 0,566150512214342
|
||||
1324,5292712066905; 0,5682972156553716
|
||||
1325,0872162485064; 0,5712489328867874
|
||||
1325,6451612903224; 0,5747373259784607
|
||||
1326,2031063321385; 0,5779573811400052
|
||||
1326,7610513739544; 0,5811774363015497
|
||||
1327,4305854241336; 0,5833241397425795
|
||||
1328,100119474313; 0,5861864109972856
|
||||
1328,7696535244922; 0,5858286270904474
|
||||
1329,4391875746715; 0,5833241397425795
|
||||
1330,1087216248507; 0,5822507880220645
|
||||
1330,7782556750299; 0,5833241397425795
|
||||
1331,447789725209; 0,5833241397425795
|
||||
1332,1173237753883; 0,5843974914630943
|
||||
1332,7868578255675; 0,5869019788109622
|
||||
1333,4563918757467; 0,5876175466246387
|
||||
1334,125925925926; 0,5883331144383153
|
||||
1334,7954599761051; 0,5895853581122492
|
||||
1335,4649940262843; 0,5901220339725066
|
||||
1336,1345280764635; 0,5883331144383153
|
||||
1336,8040621266427; 0,5869019788109622
|
||||
1337,473596176822; 0,5843974914630943
|
||||
1338,1431302270012; 0,5811774363015497
|
||||
1338,8126642771804; 0,5801040845810348
|
||||
1339,4821983273596; 0,5808196523947114
|
||||
1340,1517323775388; 0,5831452477891602
|
||||
1340,821266427718; 0,5849341673233517
|
||||
1341,3792114695339; 0,58734920869451
|
||||
1341,93715651135; 0,5903009259259259
|
||||
1342,6066905615291; 0,5919109535066981
|
||||
1343,2762246117084; 0,5919109535066981
|
||||
1343,9457586618876; 0,592984305227213
|
||||
1344,6152927120668; 0,5936998730408896
|
||||
1345,284826762246; 0,5944154408545661
|
||||
1345,9543608124252; 0,5962043603887575
|
||||
1346,6238948626044; 0,599424415550302
|
||||
1347,0702508960571; 0,6004977672708168
|
||||
1347,9629629629628; 0,5997821994571403
|
||||
1348,632497013142; 0,6012133350844935
|
||||
1349,3020310633212; 0,6033600385255231
|
||||
1349,9715651135004; 0,6033600385255231
|
||||
1350,6410991636797; 0,6037178224323614
|
||||
1351,3106332138589; 0,605864525873391
|
||||
1351,980167264038; 0,6078323373610015
|
||||
1352,6497013142173; 0,6094423649417738
|
||||
1353,3192353643965; 0,6112312844759653
|
||||
1353,9887694145757; 0,6123046361964801
|
||||
1354,658303464755; 0,6123046361964801
|
||||
1355,3278375149341; 0,6135568798704141
|
||||
1355,8857825567502; 0,6168663810086681
|
||||
1356,332138590203; 0,6206231120304702
|
||||
1356,890083632019; 0,6241115051221433
|
||||
1357,5596176821982; 0,626258208563173
|
||||
1358,2291517323774; 0,6248270729358198
|
||||
1358,8986857825566; 0,6230381534016285
|
||||
1359,4566308243727; 0,619818098240084
|
||||
1360,0145758661886; 0,6171347189387969
|
||||
1360,6841099163678; 0,617313610892216
|
||||
1361,353643966547; 0,6176713947990543
|
||||
1362,0231780167262; 0,61856585456615
|
||||
1362,6927120669054; 0,6192814223798266
|
||||
1363,1390681003584; 0,6225014775413711
|
||||
1363,585424133811; 0,626258208563173
|
||||
1364,2549581839903; 0,6284049120042028
|
||||
1364,8129032258064; 0,630014939584975
|
||||
|
66
Functions/Theory/Dissertation/PD/plot_pd_specs.m
Normal file
66
Functions/Theory/Dissertation/PD/plot_pd_specs.m
Normal file
@@ -0,0 +1,66 @@
|
||||
opts = delimitedTextImportOptions("NumVariables", 2);
|
||||
|
||||
% Specify range and delimiter
|
||||
opts.DataLines = [1, Inf];
|
||||
opts.Delimiter = ";";
|
||||
|
||||
% Specify column names and types
|
||||
opts.VariableNames = ["x0_03203105428566744", "x_0_09762908467719589"];
|
||||
opts.VariableTypes = ["double", "double"];
|
||||
|
||||
% Specify file level properties
|
||||
opts.ExtraColumnsRule = "ignore";
|
||||
opts.EmptyLineRule = "read";
|
||||
|
||||
% Specify variable properties
|
||||
opts = setvaropts(opts, ["x0_03203105428566744", "x_0_09762908467719589"], "DecimalSeparator", ",");
|
||||
opts = setvaropts(opts, ["x0_03203105428566744", "x_0_09762908467719589"], "ThousandsSeparator", ".");
|
||||
|
||||
% Import the data
|
||||
x70ghz_pd_resp = readtable("C:\Users\Silas\Documents\MATLAB\imdd_simulation\Functions\Theory\Dissertation\PD\70ghz_pd_responsivity.csv", opts);
|
||||
x70ghz_pd_bandwidth = readtable("C:\Users\Silas\Documents\MATLAB\imdd_simulation\Functions\Theory\Dissertation\PD\70ghz_pd_bandwidth.csv", opts);
|
||||
x100ghz_pd_resp = readtable("C:\Users\Silas\Documents\MATLAB\imdd_simulation\Functions\Theory\Dissertation\PD\100ghz_pd_responsivity.csv", opts);
|
||||
x100ghz_pd_bandwidth = readtable("C:\Users\Silas\Documents\MATLAB\imdd_simulation\Functions\Theory\Dissertation\PD\100ghz_pd_bandwidth.csv", opts);
|
||||
|
||||
% sort bandwidth based on first table column
|
||||
x70ghz_pd_bandwidth = sortrows(x70ghz_pd_bandwidth, "x0_03203105428566744");
|
||||
|
||||
x70ghz_pd_bandwidth.(2) = movmean(x70ghz_pd_bandwidth.(2),3);
|
||||
%smooth data for plotting
|
||||
|
||||
x100ghz_pd_bandwidth = sortrows(x100ghz_pd_bandwidth, "x0_03203105428566744");
|
||||
|
||||
|
||||
|
||||
%%
|
||||
|
||||
figure(); hold on
|
||||
plot(x100ghz_pd_resp.(1),x100ghz_pd_resp.(2))
|
||||
plot(x70ghz_pd_resp.(1),x70ghz_pd_resp.(2))
|
||||
% beautify
|
||||
xlabel('Frequency (GHz)');
|
||||
ylabel('Responsivity (A/W)');
|
||||
legend('100GHz PD', '70GHz PD');
|
||||
grid on;
|
||||
|
||||
%%
|
||||
% mat2tikz_improved('C:\Users\Silas\Documents\6971e0b65b380ca6d71c837f\02_IMDD_System\tikz\pd\responsivity.tikz')
|
||||
|
||||
%%
|
||||
|
||||
figure(); hold on
|
||||
plot(x100ghz_pd_bandwidth.(1),x100ghz_pd_bandwidth.(2))
|
||||
plot(x70ghz_pd_bandwidth.(1),x70ghz_pd_bandwidth.(2))
|
||||
% beautify
|
||||
xlabel('Frequency (GHz)');
|
||||
ylabel('Relative S21');
|
||||
legend('100GHz PD', '70GHz PD');
|
||||
grid on;
|
||||
|
||||
ylim([-3.5, 0.1])
|
||||
xlim([0 100]);
|
||||
|
||||
%%
|
||||
mat2tikz_improved('C:\Users\Silas\Documents\6971e0b65b380ca6d71c837f\02_IMDD_System\tikz\pd\bandwidth_.tikz')
|
||||
|
||||
|
||||
46
Functions/Theory/Dissertation/dispersion_around_zdw.m
Normal file
46
Functions/Theory/Dissertation/dispersion_around_zdw.m
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
% plot_dispersion_models
|
||||
% ------------------------------------------------------------
|
||||
% Visualizes exact and linearized chromatic dispersion D(λ)
|
||||
% around the zero-dispersion wavelength (ZDW).
|
||||
%
|
||||
% Inputs:
|
||||
% lambda0_nm - ZDW in nm
|
||||
% S0 - dispersion slope at ZDW [ps/(nm^2·km)]
|
||||
% ------------------------------------------------------------
|
||||
|
||||
lambda0_nm = 1310;
|
||||
S0 = [0.07,0.09]';
|
||||
% wavelength axis around ZDW
|
||||
lambda_nm = linspace(lambda0_nm-60, lambda0_nm+60, 400);
|
||||
|
||||
% exact dispersion model
|
||||
D_exact = (S0./4) .* ( ...
|
||||
lambda_nm - (lambda0_nm^4)./(lambda_nm.^3) );
|
||||
|
||||
% linearized model around ZDW
|
||||
D_lin = S0 .* (lambda_nm - lambda0_nm);
|
||||
|
||||
% plot
|
||||
figure('Color','w'); hold on;
|
||||
cols = [0.6510 0.8078 0.8902;...
|
||||
0.1216 0.4706 0.7059;...
|
||||
0.6980 0.8745 0.5412;...
|
||||
0.2000 0.6275 0.1725];
|
||||
|
||||
% plot(lambda_nm, D_lin(1,:), '-', 'LineWidth',2, 'DisplayName','Linearized model','Color',[cols(1,:)]);
|
||||
plot(lambda_nm, D_exact(1,:), 'LineWidth',2, 'DisplayName',sprintf('S_0 = 0.07'),'Color',[cols(2,:)]);
|
||||
|
||||
% plot(lambda_nm, D_lin(2,:), '-', 'LineWidth',2, 'HandleVisibility','off','Color',[cols(3,:)]);
|
||||
plot(lambda_nm, D_exact(2,:), 'LineWidth',2, 'HandleVisibility','on', 'DisplayName',sprintf('S_0 = 0.09'),'Color',[cols(4,:)]);
|
||||
|
||||
|
||||
xlabel('Wavelength $\lambda$ [nm]','Interpreter','latex');
|
||||
ylabel('D($\lambda$) [ps/(nm km)]','Interpreter','latex');
|
||||
title('Chromatic Dispersion Around the ZDW');
|
||||
legend('Location','best');
|
||||
grid on; box on;
|
||||
xlim([min(lambda_nm) max(lambda_nm)])
|
||||
ylim([-5 5]);
|
||||
|
||||
% mat2tikz_improved('C:\Users\Silas\Documents\6971e0b65b380ca6d71c837f\02_IMDD_System\tikz\dispersion\dispersion')
|
||||
120
Functions/Theory/Dissertation/loss_curve_digitized.m
Normal file
120
Functions/Theory/Dissertation/loss_curve_digitized.m
Normal file
@@ -0,0 +1,120 @@
|
||||
function loss_curve_digitized(filename)
|
||||
% PLOT_WPD_DATASETS Reads and plots scattering data from a CSV file.
|
||||
% filename: String containing the path to the CSV file (e.g., 'wpd_datasets.csv')
|
||||
%
|
||||
% This function expects a CSV with the following structure:
|
||||
% Row 1: Dataset Names (every 2nd column)
|
||||
% Row 2: Variable Names (X, Y, X, Y...)
|
||||
% Row 3+: Numeric Data (potentially with NaNs for unequal lengths)
|
||||
|
||||
% --- 1. Import Data ---
|
||||
if nargin < 1
|
||||
filename = 'wpd_datasets.csv'; % Default filename
|
||||
end
|
||||
|
||||
% Read the numeric data, skipping the first 2 header lines
|
||||
% 'TreatAsMissing' ensures empty cells become NaNs
|
||||
raw_data = readmatrix(filename, 'NumHeaderLines', 2);
|
||||
|
||||
% Read the first line separately to parse Dataset Names
|
||||
fid = fopen(filename, 'r');
|
||||
if fid == -1
|
||||
error('Could not open file: %s', filename);
|
||||
end
|
||||
header_line = fgetl(fid);
|
||||
fclose(fid);
|
||||
|
||||
% Split header by comma to get names
|
||||
raw_names = split(header_line, ',');
|
||||
|
||||
% Extract non-empty names (assuming names are in col 1, 3, 5...)
|
||||
dataset_names = raw_names(~cellfun('isempty', raw_names));
|
||||
|
||||
% --- 2. Setup Plot ---
|
||||
figure('Color', 'w', 'Position', [100, 100, 800, 600]);
|
||||
ax = gca;
|
||||
hold(ax, 'on');
|
||||
|
||||
|
||||
line_styles = {'-', '-', '-', '-'};
|
||||
|
||||
% --- 3. Iterate and Plot Each Dataset ---
|
||||
num_datasets = length(dataset_names);
|
||||
|
||||
for i = 1:num_datasets
|
||||
% Calculate column indices for X and Y
|
||||
% Dataset 1: Cols 1,2 | Dataset 2: Cols 3,4 | etc.
|
||||
col_x = (i-1)*2 + 1;
|
||||
col_y = (i-1)*2 + 2;
|
||||
|
||||
% Extract data
|
||||
if col_y > size(raw_data, 2)
|
||||
warning('Data columns missing for dataset %d', i);
|
||||
break;
|
||||
end
|
||||
|
||||
X = raw_data(:, col_x);
|
||||
Y = raw_data(:, col_y);
|
||||
|
||||
|
||||
|
||||
% Remove NaNs (missing data due to unequal lengths)
|
||||
valid_mask = ~isnan(X) & ~isnan(Y);
|
||||
X = X(valid_mask);
|
||||
Y = Y(valid_mask);
|
||||
|
||||
[X, sortIdx] = sort(X);
|
||||
Y = Y(sortIdx);
|
||||
|
||||
% 3. Smooth the Data
|
||||
|
||||
if numel(X) > 20
|
||||
if 1
|
||||
Y = smoothdata(Y, 'sgolay', 15);
|
||||
else
|
||||
Y = movmean(Y, 15);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Plotting
|
||||
% Using semilogy because scattering data often spans orders of magnitude
|
||||
% (Adjust to 'plot' if linear scale is preferred)
|
||||
p = plot(ax, X, Y, ...
|
||||
'LineStyle', line_styles{mod(i-1, length(line_styles)) + 1}, ...
|
||||
'Marker', 'none', ...
|
||||
'Color', 'black', ...
|
||||
'LineWidth', 1.5, ...
|
||||
'MarkerSize', 6, ...
|
||||
'DisplayName', dataset_names{i});
|
||||
|
||||
% Optional: Fill marker faces for better visibility
|
||||
% p.MarkerFaceColor = p.Color;
|
||||
% p.MarkerFaceAlpha = 0.3; % Semi-transparent fill
|
||||
end
|
||||
|
||||
% --- 4. Styling and Formatting ---
|
||||
|
||||
% Axis Labels (Inferred from typical scattering plots)
|
||||
xlabel(ax, 'Wavelength (\mu m)', 'FontSize', 12, 'FontWeight', 'bold');
|
||||
ylabel(ax, 'Intensity / Cross-Section (a.u.)', 'FontSize', 12, 'FontWeight', 'bold');
|
||||
|
||||
% Title
|
||||
title(ax, 'Dataset Comparison', 'FontSize', 14);
|
||||
|
||||
% Legend
|
||||
legend(ax, 'Location', 'best', 'Interpreter', 'none', 'Box', 'on');
|
||||
|
||||
% Grid
|
||||
grid(ax, 'on');
|
||||
ax.GridAlpha = 0.3;
|
||||
ax.MinorGridAlpha = 0.1;
|
||||
|
||||
% Set Log Scale for Y (likely required for this data type)
|
||||
set(ax, 'YScale', 'log');
|
||||
|
||||
% Enhance axis appearance
|
||||
set(ax, 'Box', 'on', 'LineWidth', 1.2, 'FontSize', 10);
|
||||
|
||||
hold(ax, 'off');
|
||||
end
|
||||
191
Functions/Theory/Dissertation/mach_zehnder_nonlinearities.m
Normal file
191
Functions/Theory/Dissertation/mach_zehnder_nonlinearities.m
Normal file
@@ -0,0 +1,191 @@
|
||||
|
||||
|
||||
%MZM demo -> sinus als eingang in MZM intensity TF: 2nd and 3rd roder
|
||||
%nonlinearities in PSD visible
|
||||
|
||||
clear; close all; clc;
|
||||
|
||||
set(groot,'defaultLegendInterpreter','tex');
|
||||
set(groot,'defaultAxesTickLabelInterpreter','tex');
|
||||
set(groot,'defaultTextInterpreter','tex');
|
||||
|
||||
%% Fixed parameters
|
||||
Vpi = 5.2; % [V]
|
||||
f0 = 10e9; % [Hz]
|
||||
fs = 400e9; % [Hz]
|
||||
Nper = 500; % periods for PSD quality
|
||||
|
||||
t = (0:1/fs:(Nper/f0 - 1/fs)).';
|
||||
w = 2*pi*f0;
|
||||
|
||||
% PSD settings
|
||||
nfft = 2^(nextpow2(min(length(t), 2^18))-1);
|
||||
win = hann(2^12);
|
||||
ovl = round(0.5*numel(win));
|
||||
|
||||
N_bessel = 10;
|
||||
|
||||
%% UI defaults (normalized)
|
||||
vb0 = 1.0; % Vbias/Vpi
|
||||
vpp0 = 0.5; % Vpp/Vpi
|
||||
|
||||
%% Figure + layout
|
||||
fig = figure('Color','w','Name','MZM Nonlinearity: Bias & Drive','NumberTitle','off');
|
||||
tl = tiledlayout(fig,1,2,'TileSpacing','compact','Padding','compact');
|
||||
|
||||
axTF = nexttile(tl,1); hold(axTF,'on'); grid(axTF,'on');
|
||||
axPSD = nexttile(tl,2); hold(axPSD,'on'); grid(axPSD,'on');
|
||||
|
||||
% Scatter placeholders
|
||||
hEx = scatter(axTF, nan, nan, 6, '.', 'DisplayName','Exact');
|
||||
hTa = scatter(axTF, nan, nan, 6, '.', 'DisplayName','Taylor (3rd order)');
|
||||
hJa = scatter(axTF, nan, nan, 6, '.', 'DisplayName',sprintf('Jacobi--Anger (N=%d)',N_bessel));
|
||||
hBias = plot(axTF, nan, nan, 'ko', 'MarkerFaceColor','k', 'DisplayName','Bias');
|
||||
|
||||
xlabel(axTF,'v/V_\pi'); ylabel(axTF,'P_{out}/P_0'); % <-- TeX (no $...$)
|
||||
title(axTF,'Transfer characteristic (scatter)');
|
||||
ylim(axTF,[-0.1 1.1]);
|
||||
xlim(axTF,[0 2]);
|
||||
legend(axTF,'Location','best');
|
||||
|
||||
% PSD placeholders
|
||||
hPex = plot(axPSD, nan, nan, 'LineWidth',2.0, 'DisplayName','Exact');
|
||||
hPta = plot(axPSD, nan, nan, '-', 'LineWidth',1.5, 'DisplayName','Taylor (3rd order)');
|
||||
hPja = plot(axPSD, nan, nan, '--', 'LineWidth',0.1, 'DisplayName',sprintf('Jacobi--Anger (N=%d)',N_bessel));
|
||||
|
||||
xlabel(axPSD,'Frequency [GHz]'); ylabel(axPSD,'PSD [dB/Hz]');
|
||||
title(axPSD,'Output spectrum (PSD)');
|
||||
xlim(axPSD,[0 10*f0/1e9]);
|
||||
legend(axPSD,'Location','best');
|
||||
|
||||
%% Sliders + labels
|
||||
sH = 0.05; mL = 0.08; wS = 0.38; y1 = 0.04; dy = 0.06;
|
||||
|
||||
uicontrol(fig,'Style','text','Units','normalized', ...
|
||||
'Position',[mL, y1+dy, wS, 0.03], ...
|
||||
'String','v_{bias}/V_{\pi}','HorizontalAlignment','left');
|
||||
|
||||
sBias = uicontrol(fig,'Style','slider','Units','normalized', ...
|
||||
'Position',[mL, y1+dy-0.02, wS, sH], ...
|
||||
'Min',0,'Max',2,'Value',vb0);
|
||||
|
||||
tBiasVal = uicontrol(fig,'Style','text','Units','normalized', ...
|
||||
'Position',[mL+wS+0.01, y1+dy, 0.08, 0.03], ...
|
||||
'String',sprintf('%.3f',vb0),'HorizontalAlignment','left');
|
||||
|
||||
uicontrol(fig,'Style','text','Units','normalized', ...
|
||||
'Position',[mL, y1, wS, 0.03], ...
|
||||
'String','v_{pp}/V_{\pi}','HorizontalAlignment','left');
|
||||
|
||||
sVpp = uicontrol(fig,'Style','slider','Units','normalized', ...
|
||||
'Position',[mL, y1-0.02, wS, sH], ...
|
||||
'Min',0,'Max',2,'Value',vpp0);
|
||||
|
||||
tVppVal = uicontrol(fig,'Style','text','Units','normalized', ...
|
||||
'Position',[mL+wS+0.01, y1, 0.08, 0.03], ...
|
||||
'String',sprintf('%.3f',vpp0),'HorizontalAlignment','left');
|
||||
|
||||
%% Store handles in fig.UserData (so callback can always access them)
|
||||
S = struct();
|
||||
S.Vpi = Vpi; S.f0 = f0; S.fs = fs; S.w = w; S.t = t;
|
||||
S.win = win; S.ovl = ovl; S.nfft = nfft;
|
||||
S.N_bessel = N_bessel;
|
||||
|
||||
S.axTF = axTF; S.axPSD = axPSD;
|
||||
S.hEx = hEx; S.hTa = hTa; S.hJa = hJa; S.hBias = hBias;
|
||||
S.hPex = hPex; S.hPta = hPta; S.hPja = hPja;
|
||||
|
||||
S.sBias = sBias; S.sVpp = sVpp;
|
||||
S.tBiasVal = tBiasVal; S.tVppVal = tVppVal;
|
||||
|
||||
fig.UserData = S;
|
||||
|
||||
%% Continuous update while dragging
|
||||
addlistener(sBias,'Value','PostSet',@(~,~)updatePlots(fig));
|
||||
addlistener(sVpp ,'Value','PostSet',@(~,~)updatePlots(fig));
|
||||
|
||||
% Initial draw
|
||||
updatePlots(fig);
|
||||
|
||||
%% ===== Callback (separate function at end of script) =====
|
||||
function updatePlots(fig)
|
||||
S = fig.UserData;
|
||||
|
||||
% Read slider values (normalized)
|
||||
vb_n = S.sBias.Value; % Vbias/Vpi
|
||||
vpp_n = S.sVpp.Value; % Vpp/Vpi
|
||||
|
||||
% Update value labels
|
||||
S.tBiasVal.String = sprintf('%.3f', vb_n);
|
||||
S.tVppVal.String = sprintf('%.3f', vpp_n);
|
||||
|
||||
% Convert to volts / amplitude
|
||||
Vpi = S.Vpi;
|
||||
Vbias = vb_n * Vpi;
|
||||
Vpp = vpp_n * Vpi;
|
||||
Vm = Vpp/2;
|
||||
|
||||
t = S.t; w = S.w;
|
||||
|
||||
% Drive
|
||||
v = Vbias + Vm*cos(w*t);
|
||||
x = v./Vpi;
|
||||
|
||||
% Exact intensity
|
||||
P_exact = cos((pi/2)*x).^2;
|
||||
|
||||
% Taylor 3rd order around Vbias
|
||||
k = (pi/2)/Vpi;
|
||||
vb = Vbias;
|
||||
g0 = cos(k*vb)^2;
|
||||
g1 = -k*sin(2*k*vb);
|
||||
g2 = -2*k^2*cos(2*k*vb);
|
||||
g3 = 4*k^3*sin(2*k*vb);
|
||||
dv = v - vb;
|
||||
P_taylor = g0 + g1*dv + 0.5*g2*dv.^2 + (1/6)*g3*dv.^3;
|
||||
|
||||
% Jacobi–Anger / Bessel series (truncated)
|
||||
a = pi*(Vbias/Vpi);
|
||||
b = pi*(Vm/Vpi);
|
||||
N = S.N_bessel;
|
||||
|
||||
P_ja = 0.5*ones(size(t));
|
||||
P_ja = P_ja + 0.5*cos(a)*besselj(0,b);
|
||||
|
||||
for m = 0:floor((N-1)/2)
|
||||
n = 2*m + 1;
|
||||
P_ja = P_ja - (0.5*2)*sin(a)*besselj(n,b).*cos(n*w*t);
|
||||
end
|
||||
for m = 1:floor(N/2)
|
||||
n = 2*m;
|
||||
P_ja = P_ja - (0.5*2)*cos(a)*besselj(n,b).*cos(n*w*t);
|
||||
end
|
||||
|
||||
% Update TF scatter
|
||||
S.hEx.XData = x; S.hEx.YData = P_exact;
|
||||
S.hTa.XData = x; S.hTa.YData = P_taylor;
|
||||
S.hJa.XData = x; S.hJa.YData = P_ja;
|
||||
|
||||
xb = Vbias/Vpi;
|
||||
pb = cos((pi/2)*xb)^2;
|
||||
S.hBias.XData = xb; S.hBias.YData = pb;
|
||||
|
||||
xpad = 0.05*(max(x)-min(x) + eps);
|
||||
% xlim(S.axTF,[min(x)-xpad, max(x)+xpad]);
|
||||
ylim(S.axTF,[-0.1 1.1]);
|
||||
|
||||
% PSDs
|
||||
fs = S.fs;
|
||||
[Se,f] = pwelch(P_exact-mean(P_exact), S.win, S.ovl, S.nfft, fs, 'onesided');
|
||||
[St,~] = pwelch(P_taylor-mean(P_taylor), S.win, S.ovl, S.nfft, fs, 'onesided');
|
||||
[Sj,~] = pwelch(P_ja-mean(P_ja), S.win, S.ovl, S.nfft, fs, 'onesided');
|
||||
|
||||
S.hPex.XData = f/1e9; S.hPex.YData = 10*log10(Se + realmin);
|
||||
S.hPta.XData = f/1e9; S.hPta.YData = 10*log10(St + realmin);
|
||||
S.hPja.XData = f/1e9; S.hPja.YData = 10*log10(Sj + realmin);
|
||||
|
||||
xlim(S.axPSD,[0 10*(S.f0)/1e9]);
|
||||
ylim(S.axPSD,[-180 -80]);
|
||||
|
||||
drawnow limitrate;
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
% MZM bias sweep (physical coefficients) + field & power transfer functions
|
||||
% Uses your notation:
|
||||
% Pout/Pin = cos^2( (pi/2)*(v/Vpi) ), v = Vbias + Δv
|
||||
% Taylor around Vbias:
|
||||
% Pout/Pin ≈ a0 + a1 Δv + a2 Δv^2 + a3 Δv^3
|
||||
%
|
||||
% Coefficients (physical units):
|
||||
% a0 [-], a1 [1/V], a2 [1/V^2], a3 [1/V^3]
|
||||
%
|
||||
% Also plots:
|
||||
% Field TF amplitude: Eout/Ein = cos( (pi/2)*(Vbias/Vpi) )
|
||||
% Power TF: Pout/Pin = cos^2( (pi/2)*(Vbias/Vpi) )
|
||||
|
||||
clear; close all; clc;
|
||||
|
||||
set(groot,'defaultLegendInterpreter','tex');
|
||||
set(groot,'defaultAxesTickLabelInterpreter','tex');
|
||||
set(groot,'defaultTextInterpreter','tex');
|
||||
|
||||
%% Parameters
|
||||
Vpi = 3; % [V] device half-wave voltage
|
||||
xb = linspace(0, 2, 2001); % x_b = Vbias/Vpi
|
||||
Vbias = xb * Vpi; % [V]
|
||||
|
||||
%% Static transfer functions (at Vbias)
|
||||
H_field = cos((pi/2)*xb); % field amplitude TF (balanced MZM)
|
||||
T_power = H_field.^2; % intensity TF
|
||||
|
||||
%% Taylor coefficients (physical units)
|
||||
a0 = T_power;
|
||||
a1 = -(pi/(2*Vpi)) .* sin(pi*xb); % [1/V]
|
||||
a2 = -(pi^2/(4*Vpi^2)) .* cos(pi*xb); % [1/V^2]
|
||||
a3 = +(pi^3/(12*Vpi^3)) .* sin(pi*xb); % [1/V^3]
|
||||
A0 = a0;
|
||||
A1 = a1 * Vpi;
|
||||
A2 = a2 * Vpi^2;
|
||||
A3 = a3 * Vpi^3;
|
||||
|
||||
%% Plot
|
||||
figure('Color','w'); clf;
|
||||
% --- (1) Field + power TF vs bias ---
|
||||
hold on; grid on;
|
||||
plot(xb, H_field, 'LineWidth', 1.4, 'DisplayName','Field','Color','black','LineStyle','--');
|
||||
% plot(xb, T_power, 'LineWidth', 1.4, 'DisplayName','Intensity','Color','black','LineStyle','-');
|
||||
|
||||
|
||||
% --- (2) Physical Taylor coefficients vs bias ---
|
||||
% nexttile; hold on; grid on;
|
||||
plot(xb, a0, 'LineWidth', 1.4, 'DisplayName','Intensity','Color','black','LineStyle','-');
|
||||
plot(xb, a1, 'LineWidth', 1.4, 'DisplayName','Linear');
|
||||
plot(xb, a2, 'LineWidth', 1.4, 'DisplayName','Even');
|
||||
plot(xb, a3, 'LineWidth', 1.4, 'DisplayName','Odd');
|
||||
|
||||
xlabel('$V/V_\pi$','Interpreter','latex');
|
||||
ylabel('Transfer');
|
||||
title('Static transfer functions vs bias');
|
||||
xlim([min(xb) max(xb)]);
|
||||
ylim([-1.05 1.05]);
|
||||
legend('Location','best');
|
||||
|
||||
% Optional: tighten y-limits to avoid a0 dominating the view
|
||||
% Comment out if you prefer auto-scaling.
|
||||
yl = ylim;
|
||||
ylim([min(yl(1), -max(abs([a1 a2 a3]))*1.1), max(yl(2), max(abs([a1 a2 a3]))*1.1)]);
|
||||
|
||||
xticks([0:0.5:2]);
|
||||
124
Functions/Theory/Dissertation/photo_diode.m
Normal file
124
Functions/Theory/Dissertation/photo_diode.m
Normal file
@@ -0,0 +1,124 @@
|
||||
%% ============================================================
|
||||
% SNR vs Optical Input Power (dBm) — Shot vs Thermal vs Combined
|
||||
% - Generate optical field as sine with target RMS power (verified)
|
||||
% - Magnitude-square detection -> optical power
|
||||
% - Photocurrent = Rd * P
|
||||
% - Add shot noise + thermal noise (white, PSD-based)
|
||||
% - Compute SNR for: shot-only, thermal-only, combined
|
||||
% ============================================================
|
||||
|
||||
|
||||
% Constants
|
||||
k = Constant.Boltzmann;
|
||||
q = Constant.ElementaryCharge;
|
||||
|
||||
% Receiver / PD parameters
|
||||
T = 20 + 273.15; % K
|
||||
R = 50; % Ohm (front-end/load)
|
||||
Rd = 0.7; % A/W (responsivity)
|
||||
Be = 100e9; % Hz (electrical noise bandwidth)
|
||||
Id = 0; % A (dark current, optional)
|
||||
|
||||
% Sampling for time-domain demo (needs to be >> Be)
|
||||
fs = 1e12; % Hz
|
||||
N = 2^14; % samples
|
||||
t = (0:N-1).'/fs;
|
||||
|
||||
% Choose an electrical tone within bandwidth (arbitrary for demo)
|
||||
f0 = 10e9; % Hz
|
||||
|
||||
% Thermal current PSD (two-sided) and variance in Be
|
||||
Si_th = 4*k*T/R; % A^2/Hz (two-sided)
|
||||
sigma2_th = Si_th * Be; % A^2
|
||||
sigma_th = sqrt(sigma2_th); % A_rms
|
||||
|
||||
% Optical input power sweep (in dBm)
|
||||
P_dBm = linspace(-40, 10, 300);
|
||||
P_W = 10.^((P_dBm - 30)/10); % W
|
||||
|
||||
% Pre-allocate results
|
||||
SNR_shot_dB = zeros(size(P_dBm));
|
||||
SNR_th_dB = zeros(size(P_dBm));
|
||||
SNR_tot_dB = zeros(size(P_dBm));
|
||||
|
||||
% --- Main loop over optical input power
|
||||
for ii = 1:numel(P_W)
|
||||
Pavg = P_W(ii);
|
||||
|
||||
% Optical field with RMS power = Pavg:
|
||||
% Let x(t) be the optical field amplitude such that |x|^2 has mean Pavg.
|
||||
% Use a sinusoid: x(t) = A*sin(2*pi*f0*t), then mean(|x|^2)=A^2/2.
|
||||
A = sqrt(2*Pavg); % -> mean(|x|^2) = Pavg
|
||||
|
||||
x = A * sin(2*pi*f0*t); % "optical field" (real for simplicity)
|
||||
|
||||
% Verify RMS/mean power numerically (optional)
|
||||
P_meas = mean(abs(x).^2); % should be ~ Pavg
|
||||
|
||||
a = P_meas - Pavg;
|
||||
assert(a<1);
|
||||
|
||||
% Magnitude-square detection -> optical power waveform
|
||||
Popt = abs(x).^2; % W (instantaneous)
|
||||
|
||||
% Photocurrent waveform (includes DC + 2f0 component for this demo)
|
||||
I_sig = Rd * Popt; % A
|
||||
|
||||
% Define "signal power" as the mean-squared photocurrent due to signal
|
||||
% (for this sine-squared waveform, it's OK for a demo SNR definition)
|
||||
P_sig = mean(I_sig.^2);
|
||||
|
||||
% -------- Shot noise (white) --------
|
||||
% Two-sided PSD: Si_shot = 2*q*(I_photo + I_dark)
|
||||
% For this demo, use average current to set the white-noise level:
|
||||
Ibar = mean(I_sig) + Id;
|
||||
Si_shot = 2*q*Ibar; % A^2/Hz
|
||||
sigma2_sh = Si_shot * Be; % A^2
|
||||
sigma_sh = sqrt(sigma2_sh); % A_rms
|
||||
|
||||
n_sh = sigma_sh * randn(N,1); % time-domain shot noise
|
||||
|
||||
% -------- Thermal noise (white Gaussian) --------
|
||||
n_th = sigma_th * randn(N,1); % time-domain thermal noise
|
||||
|
||||
% Noise powers (mean-square) in time domain
|
||||
Pn_sh = mean(n_sh.^2);
|
||||
Pn_th = mean(n_th.^2);
|
||||
Pn_tot = mean((n_sh + n_th).^2); % ~ Pn_sh + Pn_th (independent)
|
||||
|
||||
% SNRs
|
||||
SNR_shot = P_sig / Pn_sh;
|
||||
SNR_th = P_sig / Pn_th;
|
||||
SNR_tot = P_sig / Pn_tot;
|
||||
|
||||
SNR_shot_dB(ii) = 10*log10(SNR_shot);
|
||||
SNR_th_dB(ii) = 10*log10(SNR_th);
|
||||
SNR_tot_dB(ii) = 10*log10(SNR_tot);
|
||||
|
||||
% Optional sanity check (can comment out)
|
||||
% if ii == 1
|
||||
% fprintf('Check Pavg target/meas: %.3g W / %.3g W\n', Pavg, P_meas);
|
||||
% end
|
||||
end
|
||||
|
||||
% Plot comparison
|
||||
figure(1); clf; hold on;
|
||||
plot(P_dBm, SNR_shot_dB, 'LineWidth', 1.5);
|
||||
plot(P_dBm, SNR_th_dB, 'LineWidth', 1.5);
|
||||
plot(P_dBm, SNR_tot_dB, 'LineWidth', 1.5);
|
||||
grid on;
|
||||
xlabel('Optical input power [dBm]');
|
||||
ylabel('SNR [dB]');
|
||||
title('SNR vs Optical Input Power: Shot vs Thermal vs Combined');
|
||||
legend('Shot-noise only','Thermal-noise only','Shot + Thermal','Location','best');
|
||||
|
||||
% Print example at 0 dBm
|
||||
[~,idx0] = min(abs(P_dBm - 0));
|
||||
fprintf('At 0 dBm:\n');
|
||||
fprintf(' SNR (shot only) = %.2f dB\n', SNR_shot_dB(idx0));
|
||||
fprintf(' SNR (thermal only) = %.2f dB\n', SNR_th_dB(idx0));
|
||||
fprintf(' SNR (combined) = %.2f dB\n', SNR_tot_dB(idx0));
|
||||
|
||||
% Also print NEP based on thermal PSD (constant NEP_th)
|
||||
NEP_th = sqrt(Si_th)/Rd; % W/sqrt(Hz)
|
||||
fprintf('Thermal NEP = %.3g W/sqrt(Hz)\n', NEP_th);
|
||||
68
Functions/Theory/Dissertation/power_fading_gif.m
Normal file
68
Functions/Theory/Dissertation/power_fading_gif.m
Normal file
@@ -0,0 +1,68 @@
|
||||
%% ============================================================
|
||||
% IM/DD Power Fading Evolution GIF (1 km -> 20 km)
|
||||
% Uses the provided GifWriter (serial mode)
|
||||
% ============================================================
|
||||
|
||||
clear; close all; clc;
|
||||
|
||||
%% Fiber and system parameters
|
||||
lambda0 = 1310e-9; % zero-dispersion wavelength [m]
|
||||
lambda = 1275e-9; % operating wavelength [m]
|
||||
S0 = 0.09; % dispersion slope [ps/(nm^2·km)]
|
||||
c = physconst('lightspeed');
|
||||
|
||||
%% Derived quantities (length-independent)
|
||||
D_lambda = (S0/4) * (lambda*1e9 - (lambda0*1e9)^4/(lambda*1e9)^3); % ps/(nm·km)
|
||||
D_si = D_lambda * 1e-6; % s/m^2
|
||||
b2 = -D_si * lambda^2 / (2*pi*c); % s^2/m
|
||||
|
||||
%% Frequency grid
|
||||
f_max = 150e9;
|
||||
f = linspace(0, f_max, 4000); % [Hz]
|
||||
|
||||
%% Figure setup (keep it stable for nicer GIFs)
|
||||
fig = figure('Color','w');
|
||||
ax = axes(fig); %#ok<LAXES>
|
||||
hold(ax,'on'); grid(ax,'on'); box(ax,'on');
|
||||
xlabel(ax,'Frequency [GHz]');
|
||||
ylabel(ax,'Magnitude [dB]');
|
||||
ylim(ax,[-30 0]);
|
||||
xlim(ax,[0 f_max/1e9]);
|
||||
|
||||
%% GIF writer (serial mode; simplest)
|
||||
g = GifWriter('Name','power_fading_evolution', 'DelayTime',0.12, 'Parallel',false);
|
||||
|
||||
%% Loop: 1 km to 20 km
|
||||
L = [1:20,19:-1:1];
|
||||
for L_km = L
|
||||
L_meter = L_km * 1e3; % [m]
|
||||
|
||||
% IM/DD transfer function (power fading)
|
||||
phi = 2*pi^2 * b2 * f.^2 * L_meter;
|
||||
H = abs(cos(phi));
|
||||
HdB = 10*log10(max(H, 1e-12)); % avoid -Inf for deep notches
|
||||
|
||||
% Clear and redraw (stable axes)
|
||||
cla(ax);
|
||||
|
||||
plot(ax, f/1e9, HdB, 'LineWidth', 1.8, 'Color','black');
|
||||
|
||||
% Analytic first-null frequency marker
|
||||
f_null = sqrt(c*(0.5)/(abs(D_si)*lambda^2*L_meter));
|
||||
xline(ax, f_null/1e9, 'r--', 'LineWidth', 1.2, ...
|
||||
'Label', sprintf('f_{null}=%.1f GHz', f_null/1e9), ...
|
||||
'LabelOrientation','horizontal', ...
|
||||
'LabelVerticalAlignment','bottom');
|
||||
|
||||
title(ax, sprintf('Power Fading for: %.0f km @ 1275 nm', L_km));
|
||||
|
||||
drawnow;
|
||||
|
||||
% Add frame to GIF
|
||||
g.addFrame(fig);
|
||||
end
|
||||
|
||||
%% Done
|
||||
g.compile(fig.Number);
|
||||
|
||||
disp(fullfile(g.OutputDir, sprintf('%s_fig_%d.gif', g.Name, fig.Number)));
|
||||
@@ -0,0 +1,69 @@
|
||||
%% ============================================================
|
||||
% IM/DD Power Fading Evolution vs Wavelength (L = 10 km)
|
||||
% ============================================================
|
||||
|
||||
clear; close all; clc;
|
||||
|
||||
%% Fixed fiber parameters
|
||||
lambda0 = 1310e-9; % zero-dispersion wavelength [m]
|
||||
S0 = 0.09; % dispersion slope [ps/(nm^2·km)]
|
||||
L = 10e3; % fiber length FIXED [m]
|
||||
c = physconst('lightspeed');
|
||||
|
||||
%% Frequency grid
|
||||
f_max = 150e9;
|
||||
f = linspace(0, f_max, 4000); % [Hz]
|
||||
|
||||
%% Figure setup (stable axes for clean GIF)
|
||||
fig = figure('Color','w');
|
||||
ax = axes(fig);
|
||||
hold(ax,'on'); grid(ax,'on'); box(ax,'on');
|
||||
xlabel(ax,'Frequency [GHz]');
|
||||
ylabel(ax,'Magnitude [dB]');
|
||||
ylim(ax,[-30 0]);
|
||||
xlim(ax,[0 f_max/1e9]);
|
||||
|
||||
%% GIF writer
|
||||
g = GifWriter('Name','power_fading_vs_wavelength', ...
|
||||
'DelayTime',0.12, ...
|
||||
'Parallel',false);
|
||||
|
||||
%% Wavelength sweep (around ZDW)
|
||||
lambda_vec = linspace(1260e-9, 1360e-9, 25); % 1260–1360 nm
|
||||
|
||||
for k = 1:length(lambda_vec)
|
||||
|
||||
lambda = lambda_vec(k);
|
||||
|
||||
%% Dispersion for current wavelength
|
||||
D_lambda = (S0/4) * (lambda*1e9 - (lambda0*1e9)^4/(lambda*1e9)^3); % ps/(nm·km)
|
||||
D_si = D_lambda * 1e-6; % s/m^2
|
||||
b2 = -D_si * lambda^2 / (2*pi*c); % s^2/m
|
||||
|
||||
%% Power fading transfer function
|
||||
phi = 2*pi^2 * b2 * f.^2 * L;
|
||||
H = abs(cos(phi));
|
||||
HdB = 10*log10(max(H, 1e-12));
|
||||
|
||||
cla(ax)
|
||||
plot(ax, f/1e9, HdB, 'LineWidth',1.8,'Color','black');
|
||||
|
||||
%% First-null frequency
|
||||
if abs(D_si) > 0
|
||||
f_null = sqrt(c*(0.5)/(abs(D_si)*lambda^2*L));
|
||||
xline(ax, f_null/1e9, 'r--', 'LineWidth',1.2, ...
|
||||
'Label', sprintf('f_{null}=%.1f GHz', f_null/1e9), ...
|
||||
'LabelOrientation','horizontal', ...
|
||||
'LabelVerticalAlignment','bottom');
|
||||
end
|
||||
|
||||
title(ax, sprintf('Power Fading for: 10 km @ %.0f nm', lambda*1e9));
|
||||
|
||||
drawnow;
|
||||
g.addFrame(fig);
|
||||
end
|
||||
|
||||
%% Compile GIF
|
||||
g.compile(fig.Number);
|
||||
|
||||
disp(fullfile(g.OutputDir, sprintf('%s_fig_%d.gif', g.Name, fig.Number)));
|
||||
189
Functions/Theory/Dissertation/wpd_datasets.csv
Normal file
189
Functions/Theory/Dissertation/wpd_datasets.csv
Normal file
@@ -0,0 +1,189 @@
|
||||
Rayleigh,,Experimental,,Infrared Absorption,
|
||||
X,Y,X,Y,X,Y
|
||||
0.7066005680911753,3.651009696525016,0.7072188355785799,4.848577786727532,1.4943918372804705,0.009324755400827079
|
||||
0.7362740977034739,3.1008424465551374,0.7104385926007812,5.059236053617898,1.5870823136443164,0.04795688074913024
|
||||
0.7704634954089999,2.559836201011587,0.7143024334187478,5.3165954733738054,1.6443739975494367,0.12666181795273013
|
||||
0.8246453070916075,1.9963763545469397,0.7194723146571098,4.679249634272495,1.6900695253042852,0.3029389206853443
|
||||
0.8846384359818439,1.4197559292837703,0.7194729766137344,4.646181068667172,1.7344762235109785,0.7194296259968607
|
||||
0.9375334039861705,1.0762856922437043,0.7227053108118038,4.236869693191961,1.7975573800551148,2.1896107578891244
|
||||
0.9929980876073115,0.9010620061822204,0.7272205169484065,4.147543538340177,,
|
||||
1.0420225952274251,0.6977835411732736,0.7291487965959542,4.420849736815974,,
|
||||
1.0845923638007697,0.5842349714248559,0.7310784001567514,4.645798669234298,,
|
||||
1.129741777340298,0.4856980392071641,0.7355902965102309,4.71201487210429,,
|
||||
1.1981066716622326,0.3841608204561696,0.738821306795051,4.358286713153517,,
|
||||
1.24841405122088,0.31935666463679646,0.7414069093708566,4.059822180897163,,
|
||||
1.289688370679823,0.2850148847474179,0.742705668268381,3.676053825899206,,
|
||||
1.3541801567910463,0.23691184007300667,0.7440031032526563,3.376112267508452,,
|
||||
1.4083573347772815,0.19416797258075097,0.7452965664971838,3.235432943532804,,
|
||||
1.4618851333147547,0.16723647350379714,0.7459426361628229,3.1898499103097238,,
|
||||
1.50315548103395,0.15574103754742674,0.7549743723492774,3.0137121806723157,,
|
||||
1.5386251028515106,0.1419883611511702,0.7620678995388148,2.971117042589562,,
|
||||
1.596665459699088,0.12316075278891304,0.765291628300764,2.971049114206588,,
|
||||
1.6437444767994136,0.10759838849626362,0.7756075603390012,2.9708317538173317,,
|
||||
1.683725994970454,0.09949510555249974,0.7762523060913911,2.9708181693210105,,
|
||||
1.717258069747722,0.09398483395032568,0.7839919029465676,2.8875658983600925,,
|
||||
1.7636903552257834,0.08387517688001396,0.7885090949530442,2.767180560538318,,
|
||||
1.7940013490676008,0.07701567091052414,0.7917348095848672,2.7088647150205,,
|
||||
,,0.7936723566251598,2.6144535948583694,,
|
||||
,,0.7962546494178423,2.5233214143921474,,
|
||||
,,0.8085087904529968,2.417989089048743,,
|
||||
,,0.8104423657535417,2.435165393892523,,
|
||||
,,0.8201175237791369,2.3335556930105406,,
|
||||
,,0.8285065000830756,2.158298098247211,,
|
||||
,,0.8317335386281479,2.083056634772393,,
|
||||
,,0.8356046609689853,2.024737963659226,,
|
||||
,,0.8407639509013534,1.996148150112612,,
|
||||
,,0.8459232408337212,1.967962031984024,,
|
||||
,,0.854951005280428,1.9401206794865944,,
|
||||
,,0.8601116191260452,1.8857864945455538,,
|
||||
,,0.8691446792257491,1.7565635929668848,,
|
||||
,,0.8743052930713663,1.7073700288086895,,
|
||||
,,0.8788211611645935,1.6595617469926904,,
|
||||
,,0.8826916215488064,1.624580544751916,,
|
||||
,,0.8891397410293294,1.6130257674984603,,
|
||||
,,0.896234592132116,1.5678305544227285,,
|
||||
,,0.903974850943917,1.5131252291764425,,
|
||||
,,0.90784531132813,1.4812307005435945,,
|
||||
,,0.9155829223134326,1.470682044636039,,
|
||||
,,0.9220303798373308,1.4706147972609174,,
|
||||
,,0.9310574823274131,1.460128389693264,,
|
||||
,,0.9349259568417521,1.4600883304432553,,
|
||||
,,0.9433056657529459,1.4913980336424177,,
|
||||
,,0.9516853746641398,1.5233791328756299,,
|
||||
,,0.956844002639883,1.512557980118849,,
|
||||
,,0.9671632444612435,1.4597545460975296,,
|
||||
,,0.9710370146285795,1.379199997932108,,
|
||||
,,0.9736206313345113,1.3123773159521164,,
|
||||
,,0.9774937395452226,1.2487807938448074,,
|
||||
,,0.9826543533908398,1.213807976266501,,
|
||||
,,0.9903926263327669,1.1966468122906808,,
|
||||
,,0.9942630867169798,1.171423198750918,,
|
||||
,,1.0045796807118417,1.1630595787371243,,
|
||||
,,1.0097376467309604,1.163017033545686,,
|
||||
,,1.0219851681998686,1.1963787227370668,,
|
||||
,,1.0290753856062829,1.2220446908209617,,
|
||||
,,1.0348774354211667,1.2306917801168409,,
|
||||
,,1.0471421677623152,1.052809309517664,,
|
||||
,,1.0510159379296513,0.9947114748787712,,
|
||||
,,1.0445565651865096,1.1302083245776995,,
|
||||
,,1.0458487045177878,1.0985863367418764,,
|
||||
,,1.0542449623445975,0.9398239868494617,,
|
||||
,,1.0613444471437565,0.8692481092753317,,
|
||||
,,1.0690886776953055,0.8039684355922487,,
|
||||
,,1.0768322462902296,0.7488836107091129,,
|
||||
,,1.0800586228786773,0.7279206840193796,,
|
||||
,,1.0858633205200596,0.7125673758820761,,
|
||||
,,1.1013418522737881,0.677981252075927,,
|
||||
,,1.105210326788127,0.6779626513688453,,
|
||||
,,1.1193973811672016,0.6589337368401503,,
|
||||
,,1.1206888585418553,0.6450561487842132,,
|
||||
,,1.123272475247787,0.613802971613336,,
|
||||
,,1.129077834845794,0.5966103416145675,,
|
||||
,,1.1335910551125228,0.5965912453535225,,
|
||||
,,1.1413266802279516,0.6050805792103379,,
|
||||
,,1.147134687652457,0.5716821968068484,,
|
||||
,,1.1581006610960811,0.5401075330241505,,
|
||||
,,1.167774495208427,0.524964710284852,,
|
||||
,,1.17357786893656,0.521233298948351,,
|
||||
,,1.1890511050372914,0.5248855006959243,,
|
||||
,,1.1974327998183592,0.5248543002000403,,
|
||||
,,1.2051671010205385,0.5399272739697006,,
|
||||
,,1.2161264548979165,0.5475977747039503,,
|
||||
,,1.2225739124218147,0.5475727356323816,,
|
||||
,,1.2232186581742046,0.5475702317881956,,
|
||||
,,1.2257923455307669,0.5795255128326332,,
|
||||
,,1.2264284858470365,0.635494312878344,,
|
||||
,,1.2264218662807902,0.6822012488404363,,
|
||||
,,1.2322133247896798,0.7695840678419278,,
|
||||
,,1.2354304339853828,0.8261273126225834,,
|
||||
,,1.2386382757883407,0.9793976812064772,,
|
||||
,,1.2399224716401234,1.0365631680970249,,
|
||||
,,1.2405632456527655,1.0816189618908738,,
|
||||
,,1.2457119442791393,1.1944819289049535,,
|
||||
,,1.2508619668187624,1.3005429730851226,,
|
||||
,,1.2521488104970433,1.3379536598639075,,
|
||||
,,1.2586068593269357,1.1943726953174758,,
|
||||
,,1.2605516878900995,1.0662340854711274,,
|
||||
,,1.263782036218295,0.9932116176633944,,
|
||||
,,1.267659116168754,0.9057092045091463,,
|
||||
,,1.2721796179583538,0.8377104911187728,,
|
||||
,,1.277345527456968,0.7693377754021644,,
|
||||
,,1.2818653672899432,0.7166420946785479,,
|
||||
,,1.2954156193961235,0.639704291832398,,
|
||||
,,1.298640672071322,0.6306801565443763,,
|
||||
,,1.3018657247465204,0.6217833222901857,,
|
||||
,,1.3147579919678183,0.6396165438362177,,
|
||||
,,1.3179764250767705,0.6769403979817149,,
|
||||
,,1.3244132912946747,0.7582491296621654,,
|
||||
,,1.3295613279644238,0.8433295073010272,,
|
||||
,,1.336000180052202,0.9247376324361347,,
|
||||
,,1.3430738485430005,1.1278180580973283,,
|
||||
,,1.3449988184074253,1.2455302076050567,,
|
||||
,,1.3482112939067554,1.4050952527481475,,
|
||||
,,1.351423769406086,1.585102197634859,,
|
||||
,,1.3533487392705106,1.7505418140103943,,
|
||||
,,1.3565618767264658,1.9608478952847546,,
|
||||
,,1.3604177740649368,2.243642151072621,,
|
||||
,,1.3681421459177467,2.5671506730013776,,
|
||||
,,1.3720059867357133,2.6977396395227498,,
|
||||
,,1.3700631440424236,2.9583331848749403,,
|
||||
,,1.3745670969164077,3.267039328784058,,
|
||||
,,1.3758446732019438,3.711862721055264,,
|
||||
,,1.377124897313979,4.099294432098773,,
|
||||
,,1.381620906708467,4.929210899363566,,
|
||||
,,1.381610315402473,5.521521237053952,,
|
||||
,,1.382885243861511,6.453816707451638,,
|
||||
,,1.3828733286422676,7.332602493027707,,
|
||||
,,1.3835048352621646,8.450022001983974,,
|
||||
,,1.3847837354609505,9.465318121186383,,
|
||||
,,1.3892850405084358,10.753821633797266,,
|
||||
,,1.3950817946703227,11.46214012981349,,
|
||||
,,1.406041810504325,11.542823048802346,,
|
||||
,,1.4086254272102567,10.983569572223233,,
|
||||
,,1.4125144223799593,8.815541223987582,,
|
||||
,,1.4138145051907332,7.8697993951128655,,
|
||||
,,1.4164106990725327,6.544455667464655,,
|
||||
,,1.4170686839574151,5.678973743658009,,
|
||||
,,1.419664877839215,4.722584406045411,,
|
||||
,,1.422267691287261,3.6583795017467264,,
|
||||
,,1.4274475018749921,2.894876829955794,,
|
||||
,,1.4293982880477776,2.4244991059437035,,
|
||||
,,1.4319891862765801,2.133892660567146,,
|
||||
,,1.4365249130685465,1.6766244945281037,,
|
||||
,,1.442346821582169,1.3648832144532748,,
|
||||
,,1.44946086942707,1.0800176935856405,,
|
||||
,,1.4539886527395407,0.9239641429706197,,
|
||||
,,1.4617467843802068,0.7363233849854021,,
|
||||
,,1.4701536335130105,0.5623407795094862,,
|
||||
,,1.477900511891058,0.5055620724926202,,
|
||||
,,1.4856487141823544,0.44811473438788657,,
|
||||
,,1.4940482817922873,0.3699994982234866,,
|
||||
,,1.5005089784486785,0.32105511462339426,,
|
||||
,,1.5089019264923649,0.2845721176091456,,
|
||||
,,1.5166481429137875,0.2576601983353233,,
|
||||
,,1.5179396202884412,0.2522337011156551,,
|
||||
,,1.5359997828782272,0.23327413205434572,,
|
||||
,,1.5430966198508878,0.22196482072259285,,
|
||||
,,1.5469697280615993,0.21120862244291763,,
|
||||
,,1.5501980905199209,0.20097457800069773,,
|
||||
,,1.565674636403775,0.1953318790229525,,
|
||||
,,1.5688977032090996,0.19671762962317987,,
|
||||
,,1.5785662416684487,0.20236426842871638,,
|
||||
,,1.5837215598610688,0.2081796533603784,,
|
||||
,,1.5914545371499988,0.21721757235346942,,
|
||||
,,1.5991901622654274,0.22030852031094905,,
|
||||
,,1.6088620105078997,0.21873658192521878,,
|
||||
,,1.61208309144335,0.22502554836218797,,
|
||||
,,1.6262602164730557,0.2432590831170723,,
|
||||
,,1.626903638312196,0.2467330049135315,,
|
||||
,,1.6281904819904773,0.25383038758817866,,
|
||||
,,1.6410748057322797,0.28430548752659124,,
|
||||
,,1.660414530477476,0.29244621369149987,,
|
||||
,,1.6642816810785659,0.29661578287603696,,
|
||||
,,1.6707152375133467,0.34423590359793155,,
|
||||
,,1.6739290369259265,0.3828666146961718,,
|
||||
,,1.6758540067903511,0.4228270071256609,,
|
||||
,,1.690028483993558,0.4702407837690221,,
|
||||
,,1.6964732936909575,0.48374976893430716,,
|
||||
,,1.6996923887565347,0.5083600695634991,,
|
||||
,,1.7003318388559272,0.5380344919079171,,
|
||||
|
@@ -9,7 +9,7 @@ L = 1; % km
|
||||
|
||||
% Dispersion berechnen (lineare Näherung)
|
||||
D = S0 .* ( lambda - Lambda0 ) * L;
|
||||
% D = (S0./4) .* ( lambda - (Lambda0.^4)./(lambda^3) ) * L;
|
||||
D = (S0./4) .* ( lambda - (Lambda0.^4)./(lambda^3) ) * L;
|
||||
|
||||
%% 2D-Konturplot nur mit Linien und Text
|
||||
figure('Color','w');
|
||||
|
||||
@@ -8,25 +8,25 @@ c = physconst('lightspeed');
|
||||
S0_si = S0 * 1e3; % s/m³
|
||||
|
||||
Delta_lambda = linspace(5e-9, 80e-9, 300); % [m] detuning
|
||||
f_null_2 = sqrt( c * 0.5 ./ (S0_si .* abs(Delta_lambda) .* lambda0.^2 .* L) );
|
||||
L = 2e3; % m
|
||||
f_null_10 = sqrt( c * 0.5 ./ (S0_si .* abs(Delta_lambda) .* lambda0.^2 .* L) );
|
||||
|
||||
cols = cbrewer2('Paired',10);
|
||||
cols = [0.3467 0.5360 0.6907;...
|
||||
0.9153 0.2816 0.2878;...
|
||||
0.4416 0.7490 0.4322];
|
||||
figure('Color','w');hold on
|
||||
cnt = 2;
|
||||
for L = 10%[2,5,10]
|
||||
cnt = 1;
|
||||
for L = [2,10,40]
|
||||
f_null_10 = sqrt( c * 0.5 ./ (S0_si .* abs(Delta_lambda) .* lambda0.^2 .* L*1e3) );
|
||||
plot(1310-Delta_lambda*1e9, f_null_10/1e9, 'LineWidth',2,'DisplayName',sprintf('%d km',L),'Color',cols(cnt,:));
|
||||
cnt = cnt+2;
|
||||
cnt = cnt+1;
|
||||
end
|
||||
yticks([56,75,90,112])
|
||||
tickse = 1310-[7.5, 12, 17, 31.5];
|
||||
xticks(flip(tickse));
|
||||
% yticks([56,75,90,112])
|
||||
% tickse = 1310-[7.5, 12, 17, 31.5];
|
||||
% xticks(flip(tickse));
|
||||
|
||||
xlabel('$\Delta \lambda$ from ZDW [nm]');
|
||||
ylabel('$F_{null}$ [GHz]');
|
||||
grid on; box on;
|
||||
lim=1310-[5,35];
|
||||
lim=1310-[5,60];
|
||||
xlim([lim(2) lim(1)]);
|
||||
ylim([40,130])
|
||||
ylim([10,130])
|
||||
legend
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
%% Fiber and system parameters
|
||||
lambda0 = 1310e-9; % zero-dispersion wavelength [m]
|
||||
lambda = 1275e-9; % operating wavelength [m]
|
||||
S0 = 0.08; % dispersion slope [ps/(nm²·km)]
|
||||
lambda = 1290e-9; % operating wavelength [m]
|
||||
S0 = 0.09; % dispersion slope [ps/(nm²·km)]
|
||||
L = 10e3; % fiber length [m]
|
||||
c = physconst('lightspeed');
|
||||
|
||||
@@ -26,11 +26,11 @@ H = abs(cos(phi));
|
||||
|
||||
%% Plot
|
||||
figure('Color','w');
|
||||
plot(f/1e9, 10*log10(H), 'LineWidth', 1.8);
|
||||
plot(f/1e9, 10*log10(H), 'LineWidth', 1.8,'Color','black');
|
||||
grid on; box on;
|
||||
xlabel('Frequency [GHz]');
|
||||
ylabel('Magnitude [dB]');
|
||||
title(sprintf('IM/DD Power Fading |H| for λ = %.1f nm, L = %.1f km', lambda*1e9, L/1000));
|
||||
% title(sprintf('IM/DD Power Fading: 10 km; 1275nm', lambda*1e9, L/1000),"Interpreter","latex");
|
||||
ylim([-30 0]);
|
||||
|
||||
%% Mark analytic first-null frequency
|
||||
@@ -38,3 +38,5 @@ f_null = sqrt(c*(0.5)/(abs(D_si)*lambda^2*L));
|
||||
xline(f_null/1e9, 'r--', 'LineWidth', 1.2, ...
|
||||
'Label', sprintf('f_{null}=%.1f GHz', f_null/1e9), ...
|
||||
'LabelOrientation', 'horizontal', 'LabelVerticalAlignment', 'bottom');
|
||||
|
||||
mat2tikz_improved('C:\Users\Silas\Documents\6971e0b65b380ca6d71c837f\02_IMDD_System\tikz\dispersion\power_fading.tikz')
|
||||
317
Functions/plot_s_parameter.m
Normal file
317
Functions/plot_s_parameter.m
Normal file
@@ -0,0 +1,317 @@
|
||||
%% Plot S-parameters from Touchstone S2P or S4P (schema-aware, no RF Toolbox)
|
||||
clear; clc;
|
||||
|
||||
[file,path] = uigetfile({"*.s2p;*.S2P;*.s4p;*.S4P","Touchstone (*.s2p, *.s4p)"});
|
||||
if isequal(file,0); return; end
|
||||
filename = fullfile(path,file);
|
||||
%%
|
||||
% Decide port count by extension (minimal-invasive, robust)
|
||||
[~,~,ext] = fileparts(file);
|
||||
ext = upper(ext);
|
||||
|
||||
if strcmp(ext,'.S4P')
|
||||
[matrix, meta] = loads4p_schema(filename);
|
||||
N = 4;
|
||||
elseif strcmp(ext,'.S2P')
|
||||
[matrix, meta] = loads2p(filename); % your original loader kept (below)
|
||||
N = 2;
|
||||
else
|
||||
error("Unsupported extension: %s", ext);
|
||||
end
|
||||
|
||||
% Frequency in GHz
|
||||
frex = matrix(:,1);
|
||||
if isfield(meta,'freqScaleHz') && ~isempty(meta.freqScaleHz)
|
||||
frex = frex * meta.freqScaleHz / 1e9; % convert to GHz
|
||||
else
|
||||
% fallback heuristic (your original)
|
||||
for i = 1:numel(frex)
|
||||
if frex(i) > 1e4
|
||||
frex(i) = frex(i).*1e-9;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
figure(101);
|
||||
hold on;
|
||||
% overlay indexing: count lines already there
|
||||
if N == 2
|
||||
lines = numel(findall(gcf, 'type','line'))/4 + 1;
|
||||
else
|
||||
lines = numel(findall(gcf, 'type','line'))/16 + 1;
|
||||
end
|
||||
|
||||
% styles (kept)
|
||||
[CC, LL, MM] = ndgrid({1,2,3,4}, {'-', ':', '-.', '--'}, {'none','+', 'o', '*', 'square', 'diamond'});
|
||||
combinations = [CC(:), LL(:), MM(:)];
|
||||
cols = [0.3467 0.5360 0.6907
|
||||
0.9153 0.2816 0.2878
|
||||
0.4416 0.7490 0.4322
|
||||
1.0000 0.5984 0.2000];
|
||||
|
||||
% -------------------- Plotting --------------------
|
||||
if N == 2
|
||||
heads = ["S11","S12","S22","S21"];
|
||||
% matrix layout from loads2p:
|
||||
% col pairs:
|
||||
% 2-3 S11, 4-5 S21, 6-7 S12, 8-9 S22
|
||||
colPairs = [2 3; 6 7; 8 9; 4 5]; % order matches heads above
|
||||
subplots = 1;
|
||||
|
||||
for k = 1:4
|
||||
if subplots, subplot(2,2,k); else, figure('Color','w'); end
|
||||
hold on; grid on;
|
||||
|
||||
reCol = colPairs(k,1);
|
||||
imCol = colPairs(k,2);
|
||||
|
||||
% S-parameter magnitude in dB: 20*log10(|S|)
|
||||
response = 20*log10(abs(matrix(:,reCol) + 1i.*matrix(:,imCol)));
|
||||
response = movmean(response,1);
|
||||
|
||||
plot(frex, response, ...
|
||||
"Color", cols(combinations{lines,1},:), ...
|
||||
"DisplayName", file, ...
|
||||
"LineStyle", combinations{lines,2}, ...
|
||||
"Marker", combinations{lines,3}, ...
|
||||
"MarkerSize", 3);
|
||||
|
||||
if k == 2 || k == 3
|
||||
ylim([-6 2]);
|
||||
else
|
||||
ylim([-30 2]);
|
||||
end
|
||||
xlim([0 100]);
|
||||
title(heads(k));
|
||||
xlabel('Frequency in GHz');
|
||||
ylabel('|S| (dB)');
|
||||
legend('Location','best');
|
||||
end
|
||||
sgtitle(sprintf('S-Parameters (2-port) [%s]', meta.headerLine));
|
||||
|
||||
elseif N == 4
|
||||
% For s4p schema we plot all Sij in a 4x4 grid
|
||||
% matrix layout from loads4p_schema:
|
||||
% columns: 1=f, then pairs in order:
|
||||
% S11,S12,S13,S14, S21..S24, S31..S34, S41..S44
|
||||
subplots = 1;
|
||||
|
||||
for i = 1:4
|
||||
for j = 1:4
|
||||
sp = (i-1)*4 + j;
|
||||
if subplots, subplot(4,4,sp); else, figure('Color','w'); end
|
||||
hold on; grid on;
|
||||
|
||||
idx = (i-1)*4 + j; % 1..16 for Sij in row-major
|
||||
reCol = 1 + 2*(idx-1) + 1; % after freq col
|
||||
imCol = 1 + 2*(idx-1) + 2;
|
||||
|
||||
response = 20*log10(abs(matrix(:,reCol) + 1i.*matrix(:,imCol)));
|
||||
plot(frex, response, ...
|
||||
"Color", cols(combinations{lines,1},:), ...
|
||||
"DisplayName", file, ...
|
||||
"LineStyle", combinations{lines,2}, ...
|
||||
"Marker", combinations{lines,3}, ...
|
||||
"MarkerSize", 2);
|
||||
|
||||
xlim([0 100]);
|
||||
title(sprintf("S%d%d", i, j));
|
||||
set(gca,'FontSize',8);
|
||||
|
||||
% reduce clutter
|
||||
if j ~= 1, yticklabels([]); end
|
||||
if i ~= 4, xticklabels([]); end
|
||||
if j == 1, ylabel('|S| (dB)'); end
|
||||
if i == 4, xlabel('GHz'); end
|
||||
end
|
||||
end
|
||||
sgtitle(sprintf('S-Parameters (4-port) [%s]', meta.headerLine));
|
||||
end
|
||||
|
||||
|
||||
%% ========================================================================
|
||||
% Loader for S4P with the EXACT provided schema (4 lines per frequency)
|
||||
% ========================================================================
|
||||
function [matrix, meta] = loads4p_schema(filepath)
|
||||
meta = struct();
|
||||
meta.headerLine = "";
|
||||
meta.freqScaleHz = []; % Hz per file unit (e.g., GHz -> 1e9)
|
||||
|
||||
fid = fopen(filepath,'r');
|
||||
if fid < 0, error("Cannot open file: %s", filepath); end
|
||||
cleaner = onCleanup(@() fclose(fid));
|
||||
|
||||
% Parse header: find "#"
|
||||
freUnit = "";
|
||||
while true
|
||||
t = fgetl(fid);
|
||||
if ~ischar(t), break; end
|
||||
ts = strtrim(t);
|
||||
if startsWith(ts,'#')
|
||||
meta.headerLine = ts;
|
||||
parts = split(upper(string(ts)));
|
||||
if numel(parts) >= 2, freUnit = parts(2); end
|
||||
|
||||
switch freUnit
|
||||
case "HZ", meta.freqScaleHz = 1;
|
||||
case "KHZ", meta.freqScaleHz = 1e3;
|
||||
case "MHZ", meta.freqScaleHz = 1e6;
|
||||
case "GHZ", meta.freqScaleHz = 1e9;
|
||||
otherwise, meta.freqScaleHz = [];
|
||||
end
|
||||
break;
|
||||
end
|
||||
end
|
||||
|
||||
data = [];
|
||||
|
||||
while true
|
||||
l1 = nextNumericLine(fid);
|
||||
if strlength(l1) == 0
|
||||
break;
|
||||
end
|
||||
|
||||
% IMPORTANT: sscanf wants char for robust behavior
|
||||
v1 = sscanf(char(l1), '%f').';
|
||||
if numel(v1) < 9
|
||||
error("S4P schema mismatch: expected 9 numbers on first line of a block, got %d.\nLine: %s", numel(v1), char(l1));
|
||||
end
|
||||
|
||||
l2 = nextNumericLine(fid); if strlength(l2)==0, error("Unexpected EOF after first S4P line."); end
|
||||
l3 = nextNumericLine(fid); if strlength(l3)==0, error("Unexpected EOF after second S4P line."); end
|
||||
l4 = nextNumericLine(fid); if strlength(l4)==0, error("Unexpected EOF after third S4P line."); end
|
||||
|
||||
v2 = sscanf(char(l2), '%f').';
|
||||
v3 = sscanf(char(l3), '%f').';
|
||||
v4 = sscanf(char(l4), '%f').';
|
||||
|
||||
if numel(v2) < 8 || numel(v3) < 8 || numel(v4) < 8
|
||||
error("S4P schema mismatch: expected 8 numbers on continuation lines.\nL2: %s\nL3: %s\nL4: %s", char(l2), char(l3), char(l4));
|
||||
end
|
||||
|
||||
f = v1(1);
|
||||
s1 = v1(2:9); % S11..S14 (re/im pairs)
|
||||
s2 = v2(1:8); % S21..S24
|
||||
s3 = v3(1:8); % S31..S34
|
||||
s4 = v4(1:8); % S41..S44
|
||||
|
||||
row = [f, s1, s2, s3, s4]; % 1 + 32 = 33 columns
|
||||
data = [data; row]; %#ok<AGROW>
|
||||
end
|
||||
|
||||
matrix = data;
|
||||
end
|
||||
|
||||
|
||||
function ln = nextNumericLine(fid)
|
||||
ln = "";
|
||||
|
||||
while true
|
||||
t = fgetl(fid);
|
||||
if ~ischar(t)
|
||||
ln = "";
|
||||
return;
|
||||
end
|
||||
|
||||
ts = strtrim(t);
|
||||
|
||||
% Skip blanks and comments and header lines
|
||||
if ts=="" || startsWith(ts,'!') || startsWith(ts,'#')
|
||||
continue;
|
||||
end
|
||||
|
||||
% Remove inline comment after '!' if present
|
||||
excl = strfind(ts,'!');
|
||||
if ~isempty(excl)
|
||||
ts = strtrim(extractBefore(ts, excl(1)));
|
||||
if ts==""; continue; end
|
||||
end
|
||||
|
||||
% Keep only if there's at least one numeric token
|
||||
if ~isempty(regexp(ts,'[-+]?\d*\.?\d+(?:[eEdD][-+]?\d+)?','once'))
|
||||
ln = string(ts);
|
||||
return;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
%% ========================================================================
|
||||
% Your original loads2p (kept as-is, but returns meta too)
|
||||
% ========================================================================
|
||||
function [matrix, meta] = loads2p(filepath)
|
||||
meta = struct();
|
||||
meta.headerLine = "";
|
||||
meta.freqScaleHz = [];
|
||||
|
||||
% Try to read # line for unit scaling (minimal invasive)
|
||||
fid = fopen(filepath,'r');
|
||||
if fid >= 0
|
||||
cleaner = onCleanup(@() fclose(fid));
|
||||
while true
|
||||
t = fgetl(fid);
|
||||
if ~ischar(t), break; end
|
||||
ts = strtrim(t);
|
||||
if startsWith(ts,'#')
|
||||
meta.headerLine = ts;
|
||||
parts = split(upper(string(ts)));
|
||||
if numel(parts) >= 2
|
||||
switch parts(2)
|
||||
case "HZ", meta.freqScaleHz = 1;
|
||||
case "KHZ", meta.freqScaleHz = 1e3;
|
||||
case "MHZ", meta.freqScaleHz = 1e6;
|
||||
case "GHZ", meta.freqScaleHz = 1e9;
|
||||
end
|
||||
end
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
startRow = 2;
|
||||
formatSpec = '%20s%25s%23s%23s%23s%23s%23s%23s%23s%s%[^\n\r]';
|
||||
|
||||
fileID = fopen(filepath,'r');
|
||||
dataArray = textscan(fileID, formatSpec, 'Delimiter', '', 'WhiteSpace', '', ...
|
||||
'TextType', 'string', 'HeaderLines' ,startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
|
||||
fclose(fileID);
|
||||
|
||||
raw = repmat({''},length(dataArray{1}),length(dataArray)-1);
|
||||
for col=1:length(dataArray)-1
|
||||
raw(1:length(dataArray{col}),col) = mat2cell(dataArray{col}, ones(length(dataArray{col}), 1));
|
||||
end
|
||||
numericData = NaN(size(dataArray{1},1),size(dataArray,2));
|
||||
|
||||
for col=[1,2,3,4,5,6,7,8,9,10]
|
||||
rawData = dataArray{col};
|
||||
for row=1:size(rawData, 1)
|
||||
regexstr = '(?<prefix>.*?)(?<numbers>([-]*(\d+[\,]*)+[\.]{0,1}\d*[eEdD]{0,1}[-+]*\d*[i]{0,1})|([-]*(\d+[\,]*)*[\.]{1,1}\d+[eEdD]{0,1}[-+]*\d*[i]{0,1}))(?<suffix>.*)';
|
||||
try
|
||||
result = regexp(rawData(row), regexstr, 'names');
|
||||
numbers = result.numbers;
|
||||
|
||||
invalidThousandsSeparator = false;
|
||||
if numbers.contains(',')
|
||||
thousandsRegExp = '^[-/+]*\d+?(\,\d{3})*\.{0,1}\d*$';
|
||||
if isempty(regexp(numbers, thousandsRegExp, 'once'))
|
||||
numbers = NaN;
|
||||
invalidThousandsSeparator = true;
|
||||
end
|
||||
end
|
||||
if ~invalidThousandsSeparator
|
||||
numbers = textscan(char(strrep(numbers, ',', '')), '%f');
|
||||
numericData(row, col) = numbers{1};
|
||||
raw{row, col} = numbers{1};
|
||||
end
|
||||
catch
|
||||
raw{row, col} = rawData{row};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),raw);
|
||||
raw(R) = {NaN};
|
||||
|
||||
matrix = cell2mat(raw);
|
||||
end
|
||||
193
Libs/Violinplot-Matlab-master/violinplot_community_.m
Normal file
193
Libs/Violinplot-Matlab-master/violinplot_community_.m
Normal file
@@ -0,0 +1,193 @@
|
||||
function violins = violinplot(data, cats, varargin)
|
||||
%Violinplots plots violin plots of some data and categories
|
||||
% VIOLINPLOT(DATA) plots a violin of a double vector DATA
|
||||
%
|
||||
% VIOLINPLOT(DATAMATRIX) plots violins for each column in
|
||||
% DATAMATRIX.
|
||||
%
|
||||
% VIOLINPLOT(DATAMATRIX, CATEGORYNAMES) plots violins for each
|
||||
% column in DATAMATRIX and labels them according to the names in the
|
||||
% cell-of-strings CATEGORYNAMES.
|
||||
%
|
||||
% In the cases above DATA and DATAMATRIX can be a vector or a matrix,
|
||||
% respectively, either as is or wrapped in a cell.
|
||||
% To produce violins which have one distribution on one half and another
|
||||
% one on the other half, DATA and DATAMATRIX have to be cell arrays
|
||||
% with two elements, each containing a vector or a matrix. The number of
|
||||
% columns of the two data sets has to be the same.
|
||||
%
|
||||
% VIOLINPLOT(DATA, CATEGORIES) where double vector DATA and vector
|
||||
% CATEGORIES are of equal length; plots violins for each category in
|
||||
% DATA.
|
||||
%
|
||||
% VIOLINPLOT(TABLE), VIOLINPLOT(STRUCT), VIOLINPLOT(DATASET)
|
||||
% plots violins for each column in TABLE, each field in STRUCT, and
|
||||
% each variable in DATASET. The violins are labeled according to
|
||||
% the table/dataset variable name or the struct field name.
|
||||
%
|
||||
% violins = VIOLINPLOT(...) returns an object array of
|
||||
% <a href="matlab:help('Violin')">Violin</a> objects.
|
||||
%
|
||||
% VIOLINPLOT(..., 'PARAM1', val1, 'PARAM2', val2, ...)
|
||||
% specifies optional name/value pairs for all violins:
|
||||
% 'Width' Width of the violin in axis space.
|
||||
% Defaults to 0.3
|
||||
% 'Bandwidth' Bandwidth of the kernel density estimate.
|
||||
% Should be between 10% and 40% of the data range.
|
||||
% 'ViolinColor' Fill color of the violin area and data points. Accepts
|
||||
% 1x3 color vector or nx3 color vector where n = num
|
||||
% groups. In case of two data sets being compared it can
|
||||
% be an array of up to two cells containing nx3
|
||||
% matrices.
|
||||
% Defaults to the next default color cycle.
|
||||
% 'ViolinAlpha' Transparency of the violin area and data points.
|
||||
% Can be either a single scalar value or an array of
|
||||
% up to two cells containing scalar values.
|
||||
% Defaults to 0.3.
|
||||
% 'MarkerSize' Size of the data points, if shown.
|
||||
% Defaults to 24
|
||||
% 'MedianMarkerSize' Size of the median indicator, if shown.
|
||||
% Defaults to 36
|
||||
% 'EdgeColor' Color of the violin area outline.
|
||||
% Defaults to [0.5 0.5 0.5]
|
||||
% 'BoxColor' Color of the box, whiskers, and the outlines of
|
||||
% the median point and the notch indicators.
|
||||
% Defaults to [0.5 0.5 0.5]
|
||||
% 'MedianColor' Fill color of the median and notch indicators.
|
||||
% Defaults to [1 1 1]
|
||||
% 'ShowData' Whether to show data points.
|
||||
% Defaults to true
|
||||
% 'ShowNotches' Whether to show notch indicators.
|
||||
% Defaults to false
|
||||
% 'ShowMean' Whether to show mean indicator
|
||||
% Defaults to false
|
||||
% 'ShowBox' Whether to show the box.
|
||||
% Defaults to true
|
||||
% 'ShowMedian' Whether to show the median indicator.
|
||||
% Defaults to true
|
||||
% 'ShowWhiskers' Whether to show the whiskers
|
||||
% Defaults to true
|
||||
% 'GroupOrder' Cell of category names in order to be plotted.
|
||||
% Defaults to alphabetical ordering
|
||||
|
||||
% Copyright (c) 2016, Bastian Bechtold
|
||||
% This code is released under the terms of the BSD 3-clause license
|
||||
|
||||
hascategories = exist('cats','var') && not(isempty(cats));
|
||||
|
||||
%parse the optional grouporder argument
|
||||
%if it exists parse the categories order
|
||||
% but also delete it from the arguments passed to Violin
|
||||
grouporder = {};
|
||||
idx=find(strcmp(varargin, 'GroupOrder'));
|
||||
if ~isempty(idx) && numel(varargin)>idx
|
||||
if iscell(varargin{idx+1})
|
||||
grouporder = varargin{idx+1};
|
||||
varargin(idx:idx+1)=[];
|
||||
else
|
||||
error('Second argument of ''GroupOrder'' optional arg must be a cell of category names')
|
||||
end
|
||||
end
|
||||
|
||||
% check and correct the structure of ViolinColor input
|
||||
idx=find(strcmp(varargin, 'ViolinColor'));
|
||||
if ~isempty(idx) && iscell(varargin{idx+1})
|
||||
if length(varargin{idx+1}(:))>2
|
||||
error('ViolinColor input can be at most a two element cell array');
|
||||
end
|
||||
elseif ~isempty(idx) && isnumeric(varargin{idx+1})
|
||||
varargin{idx+1} = varargin(idx+1);
|
||||
end
|
||||
|
||||
% check and correct the structure of ViolinAlpha input
|
||||
idx=find(strcmp(varargin, 'ViolinAlpha'));
|
||||
if ~isempty(idx) && iscell(varargin{idx+1})
|
||||
if length(varargin{idx+1}(:))>2
|
||||
error('ViolinAlpha input can be at most a two element cell array');
|
||||
end
|
||||
elseif ~isempty(idx) && isnumeric(varargin{idx+1})
|
||||
varargin{idx+1} = varargin(idx+1);
|
||||
end
|
||||
|
||||
% tabular data
|
||||
if isa(data, 'dataset') || isstruct(data) || istable(data)
|
||||
if isa(data, 'dataset')
|
||||
colnames = data.Properties.VarNames;
|
||||
elseif istable(data)
|
||||
colnames = data.Properties.VariableNames;
|
||||
elseif isstruct(data)
|
||||
colnames = fieldnames(data);
|
||||
end
|
||||
catnames = {};
|
||||
if isempty(grouporder)
|
||||
for n=1:length(colnames)
|
||||
if isnumeric(data.(colnames{n}))
|
||||
catnames = [catnames colnames{n}]; %#ok<*AGROW>
|
||||
end
|
||||
end
|
||||
catnames = sort(catnames);
|
||||
else
|
||||
for n=1:length(grouporder)
|
||||
if isnumeric(data.(grouporder{n}))
|
||||
catnames = [catnames grouporder{n}];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for n=1:length(catnames)
|
||||
thisData = data.(catnames{n});
|
||||
violins(n) = Violin({thisData}, n, varargin{:});
|
||||
end
|
||||
set(gca, 'XTick', 1:length(catnames), 'XTickLabels', catnames);
|
||||
set(gca,'Box','on');
|
||||
return
|
||||
elseif iscell(data) && length(data(:))==2 % cell input
|
||||
if not(size(data{1},2)==size(data{2},2))
|
||||
error('The two input data matrices have to have the same number of columns');
|
||||
end
|
||||
elseif iscell(data) && length(data(:))>2 % cell input
|
||||
error('Up to two datasets can be compared');
|
||||
elseif isnumeric(data) % numeric input
|
||||
% 1D data, one category for each data point
|
||||
if hascategories && numel(data) == numel(cats)
|
||||
if isempty(grouporder)
|
||||
cats = categorical(cats);
|
||||
else
|
||||
cats = categorical(cats, grouporder);
|
||||
end
|
||||
|
||||
catnames = (unique(cats)); % this ignores categories without any data
|
||||
catnames_labels = {};
|
||||
for n = 1:length(catnames)
|
||||
thisCat = catnames(n);
|
||||
catnames_labels{n} = char(thisCat);
|
||||
thisData = data(cats == thisCat);
|
||||
violins(n) = Violin({thisData}, n, varargin{:});
|
||||
end
|
||||
set(gca, 'XTick', 1:length(catnames), 'XTickLabels', catnames_labels);
|
||||
set(gca,'Box','on');
|
||||
return
|
||||
else
|
||||
data = {data};
|
||||
end
|
||||
end
|
||||
|
||||
% 1D data, no categories
|
||||
if not(hascategories) && isvector(data{1})
|
||||
violins = Violin(data, 1, varargin{:});
|
||||
set(gca, 'XTick', 1);
|
||||
% 2D data with or without categories
|
||||
elseif ismatrix(data{1})
|
||||
for n=1:size(data{1}, 2)
|
||||
thisData = cellfun(@(x)x(:,n),data,'UniformOutput',false);
|
||||
violins(n) = Violin(thisData, n, varargin{:});
|
||||
end
|
||||
set(gca, 'XTick', 1:size(data{1}, 2));
|
||||
if hascategories && length(cats) == size(data{1}, 2)
|
||||
set(gca, 'XTickLabels', cats);
|
||||
end
|
||||
end
|
||||
|
||||
set(gca,'Box','on');
|
||||
|
||||
end
|
||||
@@ -78,7 +78,7 @@ for i = 1:length(fsym)
|
||||
|
||||
%%%%% Pulseforming %%%%%%
|
||||
rrca=0.3;
|
||||
X = Pulseformer("fsym",fsym(i),"fdac",256e9,"pulse","rrc","pulselength",16,"rrcalpha",rrca).process(digimod_out);
|
||||
X = Pulseformer("fsym",fsym(i),"fdac",256e9,"pulse","rc","pulselength",16,"alpha",rrca).process(digimod_out);
|
||||
|
||||
% % %%%%% Clip to PAM range %%%%%%
|
||||
min_ = min(digimod_out.signal).*1.3;
|
||||
@@ -89,7 +89,7 @@ for i = 1:length(fsym)
|
||||
|
||||
X2 = M8199A("kover",kover).process(X);
|
||||
|
||||
X = Pulseformer("fsym",fsym(i),"fdac",92e9,"pulse","rrc","pulselength",16,"rrcalpha",rrca).process(digimod_out);
|
||||
X = Pulseformer("fsym",fsym(i),"fdac",92e9,"pulse","rc","pulselength",16,"alpha",rrca).process(digimod_out);
|
||||
|
||||
% % %%%%% Clip to PAM range %%%%%%
|
||||
min_ = min(digimod_out.signal).*1.3;
|
||||
@@ -117,7 +117,7 @@ for i = 1:length(fsym)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
%%
|
||||
cols = linspecer(3);
|
||||
|
||||
figure(6)
|
||||
@@ -130,7 +130,7 @@ xlabel("Baudrate in GBaud");
|
||||
ylabel("Vpp in V")
|
||||
legend
|
||||
ylim([0.3 1.4])
|
||||
thickenfigure;
|
||||
|
||||
|
||||
figure(7)
|
||||
hold on
|
||||
@@ -142,7 +142,7 @@ xlabel("Baudrate in GBaud");
|
||||
ylabel("Output Power in dBm")
|
||||
legend
|
||||
ylim([-12 4])
|
||||
thickenfigure;
|
||||
|
||||
|
||||
figure(8)
|
||||
hold on
|
||||
@@ -154,7 +154,7 @@ xlabel("Baudrate in GBaud");
|
||||
ylabel("PAPR linear")
|
||||
legend
|
||||
ylim([3 10])
|
||||
thickenfigure;
|
||||
|
||||
|
||||
|
||||
figure(9)
|
||||
@@ -167,7 +167,7 @@ xlabel("Baudrate in GBaud");
|
||||
ylabel("Vpp in V")
|
||||
legend
|
||||
ylim([0.3 1.4])
|
||||
thickenfigure;
|
||||
|
||||
|
||||
figure(10)
|
||||
hold on
|
||||
@@ -179,7 +179,7 @@ xlabel("Baudrate in GBaud");
|
||||
ylabel("Output Power in dBm")
|
||||
legend
|
||||
ylim([-12 4])
|
||||
thickenfigure;
|
||||
|
||||
|
||||
figure(11)
|
||||
hold on
|
||||
@@ -191,6 +191,6 @@ xlabel("Baudrate in GBaud");
|
||||
ylabel("PAPR linear")
|
||||
legend
|
||||
ylim([3 10])
|
||||
thickenfigure;
|
||||
|
||||
|
||||
autoArrangeFigures
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
%%
|
||||
current = 225:10:285;
|
||||
current = string(current);
|
||||
power = [28.02, 33.2, 37.5, 42.3, 46.3, 49.3, 53.4];
|
||||
power = string(power);
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [300, 0, 0];
|
||||
taps_dfe = [2, 0, 0];
|
||||
M = 4;
|
||||
trlength = 4096*4;
|
||||
x = 225:10:285;
|
||||
BER_PAM_4 = [];
|
||||
filter_length = 210;
|
||||
eq_method = 2;
|
||||
num_signal_sweep = 11;
|
||||
our_signal = 1;
|
||||
|
||||
idx = 4;
|
||||
|
||||
obj = @(x) first_analysis_ber( ...
|
||||
current(idx), power(idx), num_pf_coeff, taps_ffe, taps_dfe, ...
|
||||
M, trlength, eq_method, filter_length, num_signal_sweep, our_signal, x);
|
||||
|
||||
x0 = [1 0.1 0.1];
|
||||
lb = [1 0 0];
|
||||
ub = [10 1 1];
|
||||
|
||||
opts = optimoptions('fmincon', ...
|
||||
'Display','iter', ...
|
||||
'Algorithm','sqp', ...
|
||||
'MaxFunctionEvaluations', 500, ...
|
||||
'StepTolerance', 1e-3, ...
|
||||
'OptimalityTolerance', 1e-3);
|
||||
|
||||
[xbest, berbest] = fmincon(obj, x0, [], [], [], [], lb, ub, [], opts);
|
||||
@@ -0,0 +1,38 @@
|
||||
%%
|
||||
current = 225:10:285;
|
||||
current = string(current);
|
||||
power = [28.02, 33.2, 37.5, 42.3, 46.3, 49.3, 53.4];
|
||||
power = string(power);
|
||||
curr_pow_num = 4;
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [300, 0, 0];
|
||||
taps_dfe = [0, 0, 0];
|
||||
M = 4;
|
||||
trlength = 4096*4;
|
||||
eq_method = 2;
|
||||
filter_length = 210;
|
||||
our_signal = 0;
|
||||
BER_vec = [];
|
||||
|
||||
for i = 1:15
|
||||
BER_value = first_analysis_ber(current(curr_pow_num), power(curr_pow_num), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length, i, our_signal);
|
||||
BER_vec = [BER_vec, BER_value];
|
||||
end
|
||||
|
||||
%%
|
||||
BER_Our_Signal = [1.2e-3,1.3e-3,9.0e-4,3.8e-4,4.8e-4,4.8e-4,5.7e-4,4.1e-4,4.8e-4,5.6e-4,3.8e-4,4.1e-4,4.1e-4,5.2e-4,3.8e-4];
|
||||
BER_Their_Signal = [5.7e-4,4.0e-4,5.2e-4,4.9e-4,5.2e-4,5.5e-4,4.8e-4,4.0e-4,3.6e-4,4.6e-4,5.7e-4,5.3e-4,4.5e-4,5.9e-4,6.4e-4];
|
||||
|
||||
figure;
|
||||
x = 1:15;
|
||||
plot(x, BER_Our_Signal, 'Marker', 'o', 'LineWidth', 1.75)
|
||||
hold on
|
||||
plot(x, BER_Their_Signal, 'Marker', 'o', 'LineWidth', 1.75)
|
||||
title('BER for FFE+PF+VNLE', 'Interpreter', 'latex')
|
||||
xlabel('Cell Entry', 'Interpreter', 'latex')
|
||||
ylabel('BER', 'Interpreter', 'latex')
|
||||
legend('Our Signal', 'Their Signal', 'Interpreter', 'latex')
|
||||
grid('minor')
|
||||
xlim([0 16])
|
||||
ylim([3e-4, 1.5e-3])
|
||||
hold off
|
||||
@@ -11,24 +11,28 @@ trlength = 4096*2;
|
||||
x = 225:10:285;
|
||||
BER_PAM_2 = [];
|
||||
post_only = 0;
|
||||
filter_length_vec = 140;
|
||||
num_signal = 11;
|
||||
our_signal = 1;
|
||||
|
||||
for eq_method = 2:4
|
||||
for eq_method = 1:4
|
||||
|
||||
if ~post_only
|
||||
for j = 1:length(current)
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method);
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length_vec, num_signal, our_signal);
|
||||
BER_PAM_2 = [BER_PAM_2, BER_run];
|
||||
end
|
||||
|
||||
save('C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\Silas DSP\imdd_simulation\projects\FSO_transmission\BER_PAM_2_' + string(eq_method) + '.mat', 'x', 'BER_PAM_2')
|
||||
end
|
||||
save('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_2_' + string(eq_method) + '.mat', 'x', 'BER_PAM_2')
|
||||
BER_PAM_2 = [];
|
||||
|
||||
end
|
||||
|
||||
%%
|
||||
x = 225:10:285;
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\Silas DSP\imdd_simulation\projects\FSO_transmission\BER_PAM_2_' + string(k) + '.mat');
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_2_' + string(k) + '.mat');
|
||||
BER = BER.BER_PAM_2;
|
||||
|
||||
figure(202120)
|
||||
@@ -50,10 +54,10 @@ legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Location','southwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(280,2.2e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(280,3.3e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(280,5.4e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(280,2.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
text(221,2.2e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(221,3.3e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(221,5.4e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(231,2.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex')
|
||||
ylabel('BER', 'Interpreter','latex')
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
%%
|
||||
current = 225:10:285;
|
||||
current = string(current);
|
||||
power = [28.02, 33.2, 37.5, 42.3, 46.3, 49.3, 53.4];
|
||||
power = string(power);
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [200, 0, 0];
|
||||
taps_dfe = [0, 0, 0];
|
||||
M = 2;
|
||||
trlength = 4096*2;
|
||||
x = 225:10:285;
|
||||
BER_PAM_2 = [];
|
||||
BER_num_signal_sweep = [];
|
||||
BER_num_signal_sweep_matrix = [];
|
||||
post_only = 0;
|
||||
filter_length = 140;
|
||||
our_signal = 1;
|
||||
idx_opt = [];
|
||||
|
||||
for eq_method = 1:4
|
||||
for j = 1:length(power)
|
||||
for num_signal_sweep = 1:15
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length, num_signal_sweep, our_signal);
|
||||
BER_num_signal_sweep = [BER_num_signal_sweep, BER_run];
|
||||
end
|
||||
[BER_opt, num_signal_opt] = min(BER_num_signal_sweep);
|
||||
BER_PAM_2 = [BER_PAM_2, BER_opt];
|
||||
idx_opt = [idx_opt, num_signal_opt];
|
||||
BER_num_signal_sweep_matrix = [BER_num_signal_sweep_matrix; BER_num_signal_sweep];
|
||||
BER_num_signal_sweep = [];
|
||||
end
|
||||
save('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_2_Optimal' + string(eq_method) + '.mat', 'BER_PAM_2', 'BER_num_signal_sweep_matrix', 'idx_opt')
|
||||
BER_PAM_2 = [];
|
||||
idx_opt = [];
|
||||
end
|
||||
|
||||
%%
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_2_Optimal' + string(k) + '.mat');
|
||||
BER_values = BER.BER_PAM_2;
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
old_BER = [-1.5, -1.75, -2, -2.3, -2.6, -2.25, -1.95];
|
||||
old_BER = 10.^(old_BER);
|
||||
plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','northwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(23,2.6e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(23,2.6e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(23.5,6.5e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(23,1.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex', 'FontSize', 14)
|
||||
ylabel('BER', 'Interpreter','latex', 'FontSize', 14)
|
||||
% title('BER for PAM-4', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
ylim([1e-4 5e-1])
|
||||
set(gca,'YScale','log')
|
||||
% beautifyBERplot
|
||||
hold off
|
||||
@@ -5,34 +5,37 @@ power = [28.02, 33.2, 37.5, 42.3, 46.3, 49.3, 53.4];
|
||||
power = string(power);
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [300, 0, 0];
|
||||
taps_dfe = [5, 0, 0];
|
||||
taps_dfe = [0, 0, 0];
|
||||
M = 4;
|
||||
trlength = 4096*4;
|
||||
x = 225:10:285;
|
||||
BER_PAM_4 = [];
|
||||
filter_length = 210;
|
||||
num_signal = 11;
|
||||
our_signal = 1;
|
||||
|
||||
for eq_method = 2
|
||||
for j = 4
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method);
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length, num_signal, our_signal);
|
||||
BER_PAM_4 = [BER_PAM_4, BER_run];
|
||||
save_and_append('meineDB.sqlite', 'BER_PAM_4_Save_and_Append', eq_method, num_signal, BER_run, x)
|
||||
end
|
||||
save('C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\Silas DSP\imdd_simulation\projects\FSO_transmission\BER_PAM_4_DFE_' + string(eq_method) + '.mat', 'x', 'BER_PAM_4')
|
||||
BER_PAM_4 = [];
|
||||
end
|
||||
|
||||
%%
|
||||
x = 225:10:285;
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\Silas DSP\imdd_simulation\projects\FSO_transmission\BER_PAM_4_' + string(k) + '.mat');
|
||||
BER = BER.BER_PAM_4;
|
||||
x = 0:5:40;
|
||||
for k = 2
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_DFE_Tap_Sweep_' + string(k) + '.mat');
|
||||
BER_values = BER.BER_PAM_4;
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER, '-o','LineWidth',1.75);
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
old_BER = [-1.6, -1.85, -2.2, -2.45, -2.3, -2, -1.4];
|
||||
old_BER = 10.^(old_BER);
|
||||
plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
% old_BER = [-1.6, -1.85, -2.2, -2.45, -2.3, -2, -1.4];
|
||||
% old_BER = 10.^(old_BER);
|
||||
% plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
@@ -42,16 +45,16 @@ h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','southwest', 'FontSize', 14)
|
||||
'Location','northwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(286,2.2e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(285,3.3e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(282.5,5.4e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(287,2.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
text(23,2.6e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(23,2.6e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(23.5,6.5e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(23,1.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex')
|
||||
ylabel('BER', 'Interpreter','latex')
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex', 'FontSize', 14)
|
||||
ylabel('BER', 'Interpreter','latex', 'FontSize', 14)
|
||||
% title('BER for PAM-4', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
|
||||
@@ -10,20 +10,22 @@ trlength = 4096*4;
|
||||
x = 4:1:8;
|
||||
BER_PAM_4 = [];
|
||||
Alpha_PAM_4 = [];
|
||||
filter_length = 210;
|
||||
num_signal = 11;
|
||||
|
||||
for method = 1:4
|
||||
for i = 1:5
|
||||
[BER_run, ~] = first_analysis_baud_rate_sweep(baud_rate(i), power(i), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, method);
|
||||
for i = 1:length(power)
|
||||
[BER_run, ~] = first_analysis_baud_rate_sweep(baud_rate(i), power(i), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, method, filter_length, num_signal);
|
||||
BER_PAM_4 = [BER_PAM_4, BER_run];
|
||||
% Alpha_PAM_4 = [Alpha_PAM_4, Alpha_run];
|
||||
end
|
||||
save('C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\Silas DSP\imdd_simulation\projects\FSO_transmission\New Baud Rate Sweep Data\BER_PAM_4_' + string(method) + '.mat', 'x', 'BER_PAM_4')
|
||||
save('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Baud_Rate_Sweep_' + string(method) + '.mat', 'x', 'BER_PAM_4')
|
||||
BER_PAM_4 = [];
|
||||
end
|
||||
|
||||
%% BER
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\Silas DSP\imdd_simulation\projects\FSO_transmission\New Baud Rate Sweep Data\BER_PAM_4_' + string(k) + '.mat');
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Baud_Rate_Sweep_' + string(k) + '.mat');
|
||||
BER = BER.BER_PAM_4;
|
||||
% x = BER.x;
|
||||
% BER_Alpha = load(filename);
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
baud_rate = 4:1:8;
|
||||
baud_rate = string(baud_rate);
|
||||
power = [8.4, 8.4, 42.3, 8.4, 8.4];
|
||||
power = string(power);
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [300, 0, 0];
|
||||
taps_dfe = [0, 0, 0];
|
||||
M = 4;
|
||||
trlength = 4096*4;
|
||||
x = 4:1:8;
|
||||
BER_PAM_4 = [];
|
||||
BER_num_signal_sweep = [];
|
||||
BER_num_signal_sweep_matrix = [];
|
||||
Alpha_PAM_4 = [];
|
||||
filter_length = 210;
|
||||
idx_opt = [];
|
||||
|
||||
for method = 1:4
|
||||
for j = 1:length(power)
|
||||
for num_signal_sweep = 1:15
|
||||
[BER_run, ~] = first_analysis_baud_rate_sweep(baud_rate(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, method, filter_length, num_signal_sweep);
|
||||
BER_num_signal_sweep = [BER_num_signal_sweep, BER_run];
|
||||
% Alpha_PAM_4 = [Alpha_PAM_4, Alpha_run];
|
||||
end
|
||||
[BER_opt, num_signal_opt] = min(BER_num_signal_sweep);
|
||||
BER_PAM_4 = [BER_PAM_4, BER_opt];
|
||||
idx_opt = [idx_opt, num_signal_opt];
|
||||
BER_num_signal_sweep_matrix = [BER_num_signal_sweep_matrix; BER_num_signal_sweep];
|
||||
BER_num_signal_sweep = [];
|
||||
end
|
||||
save('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Baud_Rate_Sweep_Optimal_' + string(method) + '.mat', 'BER_PAM_4', 'BER_num_signal_sweep_matrix', 'idx_opt')
|
||||
BER_PAM_4 = [];
|
||||
end
|
||||
|
||||
%% BER
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Baud_Rate_Sweep_Optimal_' + string(k) + '.mat');
|
||||
BER = BER.BER_PAM_4;
|
||||
% x = BER.x;
|
||||
% BER_Alpha = load(filename);
|
||||
% BER = BER_Alpha.BER_PAM_4;
|
||||
|
||||
% close all
|
||||
figure(239)
|
||||
plot(x, BER, '-o','LineWidth',1.75)
|
||||
hold on
|
||||
end
|
||||
|
||||
% old_BER = [-4.4, -4, -3.3, -2.7, -2.5, -2.475];
|
||||
% old_BER = 10.^(old_BER);
|
||||
% plot(x, old_BER, '--o','LineWidth',1)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE','FFE+PF+MLSE','DB','ML-MLSE',...
|
||||
'Interpreter','latex', ...
|
||||
'Location','southwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(8.2,2.3e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(8.2,3e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(8.2,5.6e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(8.2,2.5e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Symbol Rate [GBd]', 'Interpreter','latex')
|
||||
ylabel('BER', 'Interpreter','latex')
|
||||
% title('BER for PAM-4', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
% ylim([1e-4 5e-2])
|
||||
xlim([3 9])
|
||||
set(gca,'YScale','log')
|
||||
hold off
|
||||
|
||||
%% Channel Alpha
|
||||
% Alpha = BER_Alpha.Alpha_PAM_4;
|
||||
% figure
|
||||
% plot(x, Alpha, '--o','LineWidth',1)
|
||||
% hold on
|
||||
% xlabel('Symbol Rate [GBd]', 'Interpreter','latex')
|
||||
% ylabel('Channel Alpha', 'Interpreter','latex')
|
||||
% title('Channel Alpha for PAM-4 - 300-Tap-FFE - 1 Postfilter Coefficients - 8192 Training Symbols', 'Interpreter','latex')
|
||||
% grid minor
|
||||
% hold off
|
||||
@@ -0,0 +1,73 @@
|
||||
%%
|
||||
current = 225:10:285;
|
||||
current = string(current);
|
||||
power = [28.02, 33.2, 37.5, 42.3, 46.3, 49.3, 53.4];
|
||||
power = string(power);
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [300, 0, 0];
|
||||
taps_dfe = [0, 0, 0];
|
||||
M = 4;
|
||||
trlength = 4096*4;
|
||||
x = 225:10:285;
|
||||
BER_PAM_4 = [];
|
||||
BER_num_signal_sweep = [];
|
||||
BER_num_signal_sweep_matrix = [];
|
||||
filter_length = 210;
|
||||
our_signal = 1;
|
||||
idx_opt = [];
|
||||
|
||||
for eq_method = 1:4
|
||||
for j = 1:length(power)
|
||||
for num_signal_sweep = 1:15
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length, num_signal_sweep, our_signal);
|
||||
BER_num_signal_sweep = [BER_num_signal_sweep, BER_run];
|
||||
end
|
||||
[BER_opt, num_signal_opt] = min(BER_num_signal_sweep);
|
||||
BER_PAM_4 = [BER_PAM_4, BER_opt];
|
||||
idx_opt = [idx_opt, num_signal_opt];
|
||||
BER_num_signal_sweep_matrix = [BER_num_signal_sweep_matrix; BER_num_signal_sweep];
|
||||
BER_num_signal_sweep = [];
|
||||
end
|
||||
save('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Optimal' + string(eq_method) + '.mat', 'BER_PAM_4', 'BER_num_signal_sweep_matrix', 'idx_opt')
|
||||
BER_PAM_4 = [];
|
||||
idx_opt = [];
|
||||
end
|
||||
|
||||
%%
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Optimal' + string(k) + '.mat');
|
||||
BER_values = BER.BER_PAM_4;
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
% old_BER = [-1.6, -1.85, -2.2, -2.45, -2.3, -2, -1.4];
|
||||
% old_BER = 10.^(old_BER);
|
||||
% plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','northwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(23,2.6e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(23,2.6e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(23.5,6.5e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(23,1.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex', 'FontSize', 14)
|
||||
ylabel('BER', 'Interpreter','latex', 'FontSize', 14)
|
||||
% title('BER for PAM-4', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
ylim([1e-4 5e-1])
|
||||
set(gca,'YScale','log')
|
||||
% beautifyBERplot
|
||||
hold off
|
||||
@@ -0,0 +1,64 @@
|
||||
%%
|
||||
current = 225:10:285;
|
||||
current = string(current);
|
||||
power = [28.02, 33.2, 37.5, 42.3, 46.3, 49.3, 53.4];
|
||||
power = string(power);
|
||||
num_pf_coeff = 4;
|
||||
taps_ffe = [300, 0, 0];
|
||||
taps_dfe = [5, 0, 0];
|
||||
M = 4;
|
||||
trlength = 4096*4;
|
||||
x = 225:10:285;
|
||||
BER_PAM_4 = [];
|
||||
filter_length = 210;
|
||||
num_signal = 11;
|
||||
our_signal = 1;
|
||||
|
||||
for eq_method = 2
|
||||
for j = 4
|
||||
BER_run = first_analysis_ber(current(j), power(j), num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length, num_signal, our_signal);
|
||||
BER_PAM_4 = [BER_PAM_4, BER_run];
|
||||
save_and_append('FSO_DB.sqlite', 'BER_PAM_4_Save_and_Append', 0, eq_method, num_signal, BER_run, x, taps_ffe)
|
||||
end
|
||||
BER_PAM_4 = [];
|
||||
end
|
||||
|
||||
%%
|
||||
x = 0:5:40;
|
||||
for k = 2
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Save_and_Append.mat');
|
||||
BER_values = BER.BER_PAM_4;
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
% old_BER = [-1.6, -1.85, -2.2, -2.45, -2.3, -2, -1.4];
|
||||
% old_BER = 10.^(old_BER);
|
||||
% plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','northwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(23,2.6e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(23,2.6e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(23.5,6.5e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(23,1.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex', 'FontSize', 14)
|
||||
ylabel('BER', 'Interpreter','latex', 'FontSize', 14)
|
||||
% title('BER for PAM-4', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
ylim([1e-4 5e-1])
|
||||
set(gca,'YScale','log')
|
||||
% beautifyBERplot
|
||||
hold off
|
||||
@@ -0,0 +1,3 @@
|
||||
run('evalscript_pam_2_opt')
|
||||
run('evalscript_pam_4_opt')
|
||||
run('evalscript_pam_4_baud_rate_sweep_opt')
|
||||
@@ -1,4 +1,4 @@
|
||||
function [BER, Channel_Alpha] = first_analysis_baud_rate_sweep(baud_rate, power, num_pf_coeff, taps_ffe, taps_dfe, M, trlength, method)
|
||||
function [BER, Channel_Alpha] = first_analysis_baud_rate_sweep(baud_rate, power, num_pf_coeff, taps_ffe, taps_dfe, M, trlength, method, filter_length, num_signal)
|
||||
%%
|
||||
close all
|
||||
base = "C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\FSO Equalizer\Sweep Data\";
|
||||
@@ -90,7 +90,7 @@ function [BER, Channel_Alpha] = first_analysis_baud_rate_sweep(baud_rate, power,
|
||||
% timing sync -> at this point we still have no symbol timing recovery, we
|
||||
% try to do this with 2sps EQ!
|
||||
[~,Rx_synced_cell,inverted,sequenceFound,sequenceStarts] = Rx_matched.tsynch("reference", Symbols, "fs_ref", fsym, "debug_plots", 1);
|
||||
Rx_matched_1 = Rx_synced_cell{1};
|
||||
Rx_matched_1 = Rx_synced_cell{num_signal};
|
||||
|
||||
% Rx_Time_Rec = Rx_matched;
|
||||
% Rx_Time_Rec = Timing_Recovery_Move_It('f_sim', 28e9, 'gamma', 0.1).process(Rx_matched_1);
|
||||
@@ -172,18 +172,6 @@ function [BER, Channel_Alpha] = first_analysis_baud_rate_sweep(baud_rate, power,
|
||||
% Channel_Alpha = mlse_results.metrics.Alpha;
|
||||
|
||||
elseif method == 3
|
||||
%% -------------------- ML-based MLSE (L=2) --------------------
|
||||
ml_mlse_equalizer = ML_MLSE("epochs_tr",150,"epochs_dd",1, ...
|
||||
"len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",80,"sps",sps, ...
|
||||
"traceback_depth",256,"L",1,"delta",4,"adaptive_mu",0);
|
||||
|
||||
[ml_mlse_results] = ml_mlse(ml_mlse_equalizer, M, Rx_synced, Symbols, Bits,"precode_mode",duob_mode,"eth_style_symbol_mapping",mapping_style);
|
||||
fprintf('ML-based MLSE:\n');
|
||||
fprintf('My EQ: %.1e \n',ml_mlse_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
BER = ml_mlse_results.metrics.BER;
|
||||
|
||||
elseif method == 4
|
||||
%% -------------------- DB target --------------------
|
||||
mlse_db_ = MLSE("DIR",[1,1],"duobinary_output",0,"M",M,'trellis_states',PAMmapper(M,0).levels);
|
||||
|
||||
@@ -197,6 +185,19 @@ function [BER, Channel_Alpha] = first_analysis_baud_rate_sweep(baud_rate, power,
|
||||
fprintf('My EQ: %.1e \n',dbt_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
BER = dbt_results.metrics.BER;
|
||||
|
||||
elseif method == 4
|
||||
%% -------------------- ML-based MLSE (L=2) --------------------
|
||||
ml_mlse_equalizer = ML_MLSE("epochs_tr",150,"epochs_dd",1, ...
|
||||
"len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",filter_length,"sps",sps, ...
|
||||
"traceback_depth",256,"L",1,"delta",4,"adaptive_mu",0);
|
||||
|
||||
[ml_mlse_results] = ml_mlse(ml_mlse_equalizer, M, Rx_synced, Symbols, Bits,"precode_mode",duob_mode,"eth_style_symbol_mapping",mapping_style);
|
||||
fprintf('ML-based MLSE:\n');
|
||||
fprintf('My EQ: %.1e \n',ml_mlse_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
BER = ml_mlse_results.metrics.BER;
|
||||
|
||||
end
|
||||
Channel_Alpha = 0;
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method)
|
||||
function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe, taps_dfe, M, trlength, eq_method, filter_length, num_signal, our_signal, weighted_DFE)
|
||||
%%
|
||||
close all
|
||||
|
||||
@@ -12,9 +12,11 @@ function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe,
|
||||
if M == 2
|
||||
tx_data_path = fullfile(base, "14G_PAM2\tx_info\tx_info_PAM2_14Gbd0.75RRC.mat");
|
||||
filename = fullfile(base, "14G_PAM2\M=2_Rs=1.4e10_Fs=8e10_I=" + current + "mA_RoP=" + power + "mW_L=31m_PS=RRC_rolloff=0.75_Mode=Rise.mat");
|
||||
data_tr_mf = load("C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\FSO Equalizer\FSO_FP_QCL_60umUTC\Already Recovered and Filtered\AfterSync_M=2_Rs=1.4e10_Fs=8e10_I=265mA_RoP=46.3mW_L=31m_PS=RRC_rolloff=0.75_Mode=Rise.mat");
|
||||
elseif M == 4
|
||||
tx_data_path = fullfile(base, "6G_PAM4\tx_info\tx_info_PAM4_6Gbd0.6RRC.mat");
|
||||
filename = fullfile(base, "6G_PAM4\M=4_Rs=6e9_Fs=8e10_I=" + current + "mA_RoP=" + power + "mW_L=31m_PS=RRC_rolloff=0.6_Mode=Rise.mat");
|
||||
data_tr_mf = load("C:\Users\magf\Desktop\Desktop\MATLAB-Zeugs\FSO Equalizer\FSO_FP_QCL_60umUTC\Already Recovered and Filtered\AfterSync_M=4_Rs=6e9_Fs=8e10_I=255mA_RoP=42.3mW_L=31m_PS=RRC_rolloff=0.6_Mode=Rise.mat");
|
||||
end
|
||||
|
||||
if mode == 1
|
||||
@@ -92,7 +94,11 @@ function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe,
|
||||
% timing sync -> at this point we still have no symbol timing recovery, we
|
||||
% try to do this with 2sps EQ!
|
||||
[~,Rx_synced_cell,inverted,sequenceFound,sequenceStarts] = Rx_matched.tsynch("reference", Symbols, "fs_ref", fsym, "debug_plots", 1);
|
||||
Rx_matched_1 = Rx_synced_cell{1};
|
||||
Rx_matched_1 = Rx_synced_cell{num_signal};
|
||||
|
||||
data_tr_mf = Electricalsignal(data_tr_mf.Results, "fs", fsym);
|
||||
[~,Rx_synced_cell_tr_mf,inverted_tr_mf,sequenceFound_tr_mf,sequenceStarts_tr_mf] = data_tr_mf.tsynch("reference", Symbols, "fs_ref", fsym, "debug_plots", 1);
|
||||
Rx_tr_mf = Rx_synced_cell_tr_mf{num_signal};
|
||||
|
||||
% Rx_Time_Rec = Rx_matched;
|
||||
% Rx_Time_Rec = Timing_Recovery_Move_It('f_sim', 28e9, 'gamma', 0.1).process(Rx_matched_1);
|
||||
@@ -106,13 +112,21 @@ function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe,
|
||||
end
|
||||
Rx_Time_Rec.fs = fsym;
|
||||
|
||||
Rx_Time_Rec = Rx_Time_Rec.normalize('mode','rms');
|
||||
Rx_tr_mf = Rx_tr_mf.normalize('mode','rms');
|
||||
|
||||
% Rx_Time_Rec.signal = resample(Rx_Time_Rec.signal, 12e9, 6e9);
|
||||
|
||||
% Rx_matched_1.plot("fignum",231231)
|
||||
% Rx_Time_Rec.plot("fignum",231231)
|
||||
|
||||
%% not working..
|
||||
if our_signal
|
||||
Rx_synced = Rx_Time_Rec;
|
||||
else
|
||||
Rx_synced = Rx_tr_mf;
|
||||
end
|
||||
% Rx_synced = Rx_Time_Rec;
|
||||
% Rx_synced = Rx_synced_cell{1};
|
||||
len_tr = trlength;
|
||||
mu_ffe1 = 0.0001;
|
||||
@@ -140,7 +154,7 @@ function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe,
|
||||
|
||||
%% -------------------- FFE --------------------
|
||||
% requires some more digging what is going on :-)
|
||||
eq_ffe = EQ("Ne",[500, 0, 0],"Nb",[0,0,0], ...
|
||||
eq_ffe = EQ("Ne",[500, 0, 0],"Nb",[0, 0, 0], ...
|
||||
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",sps,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||
@@ -162,7 +176,8 @@ function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe,
|
||||
eq_v = EQ("Ne",taps_ffe,"Nb",taps_dfe, ...
|
||||
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",sps,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",0,'weighted_DFE',1,'weighted_DFE_d_min',0.5, ...
|
||||
'weighted_DFE_mode','I2','weighted_DFE_I_mode',weighted_DFE,'PDFE_coefficient',0.01);
|
||||
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0,"eth_style",mapping_style).levels);
|
||||
|
||||
@@ -194,7 +209,7 @@ function BER_value = first_analysis_ber(current, power, num_pf_coeff, taps_ffe,
|
||||
|
||||
%% -------------------- ML-based MLSE (L=2) --------------------
|
||||
ml_mlse_equalizer = ML_MLSE("epochs_tr",150,"epochs_dd",1, ...
|
||||
"len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",80,"sps",1, ...
|
||||
"len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",filter_length,"sps",1, ...
|
||||
"traceback_depth",256,"L",1,"delta",4,"adaptive_mu",0);
|
||||
|
||||
[ml_mlse_results] = ml_mlse(ml_mlse_equalizer, M, Rx_synced, Symbols, Bits,"precode_mode",duob_mode,"eth_style_symbol_mapping",mapping_style);
|
||||
|
||||
@@ -98,7 +98,7 @@ H_transfer = Rx_spectrum.signal./Tx_spectrum.signal;
|
||||
H_inv = 1./H_transfer;
|
||||
|
||||
%Number of Samples/Symbol after Matched Filter
|
||||
Kov = 14;
|
||||
Kov = 40;
|
||||
|
||||
Scope_sig = Scope_sig.resample('fs_in',fs,'fs_out',Kov*fsym);
|
||||
|
||||
@@ -114,7 +114,7 @@ Rx_matched.spectrum("displayname",'Signal after matched filter','fignum',1);
|
||||
|
||||
data_tr_mf = Electricalsignal(data_tr_mf.Results, "fs", fsym);
|
||||
[~,Rx_synced_cell_tr_mf,inverted_tr_mf,sequenceFound_tr_mf,sequenceStarts_tr_mf] = data_tr_mf.tsynch("reference", Symbols, "fs_ref", fsym, "debug_plots", 1);
|
||||
Rx_tr_mf = Rx_synced_cell_tr_mf{1};
|
||||
Rx_tr_mf = Rx_synced_cell_tr_mf{11};
|
||||
|
||||
% timing sync -> at this point we still have no symbol timing recovery, we
|
||||
% try to do this with 2sps EQ!
|
||||
@@ -123,7 +123,7 @@ Rx_tr_mf = Rx_synced_cell_tr_mf{1};
|
||||
% Rx_matched = Rx_matched.resample("fs_out",2*fsym);
|
||||
|
||||
[~,Rx_synced_cell,inverted,sequenceFound,sequenceStarts] = Rx_matched.tsynch("reference", Symbols, "fs_ref", fsym, "debug_plots", 1);
|
||||
Rx_matched_1 = Rx_synced_cell{1};
|
||||
Rx_matched_1 = Rx_synced_cell{11};
|
||||
|
||||
Rx_matched_original = Rx_synced_cell{1};
|
||||
Rx_matched_original.signal = resample(Rx_matched_original.signal,1,Kov);
|
||||
@@ -135,14 +135,15 @@ Time_Rec = 1;
|
||||
if Time_Rec
|
||||
% [Rx_Time_Rec, Timing_Error] = Timing_Recovery("modulation", 'PAM/PSK/QAM', "timing_error_detector",'Gardner (non-data-aided)','sps',Kov,'damping_factor',1,'normalized_loop_bandwidth',1e-4,'detector_gain',2.7).process(Rx_matched_1);
|
||||
|
||||
[Rx_Time_Rec, Timing_Error_MG] = Godard_Timing_Recovery('mode',3,'num_blocks',1,'fft_length',length(Rx_matched_1),'sps',Kov,'rolloff',0.6,'mu',-0.2,'Ki',1e-4).process(Rx_matched_1);
|
||||
Rx_Time_Rec = Rx_Time_Rec.resample('fs_in',Kov*fsym,'fs_out',fsym);
|
||||
% [Rx_Time_Rec, Timing_Error_MG] = Godard_Timing_Recovery('mode',2,'num_blocks',1,'fft_length',length(Rx_matched_1),'sps',Kov,'rolloff',0.6,'mu',-0.2,'Ki',1e-4).process(Rx_matched_1);
|
||||
% Rx_Time_Rec = Rx_Time_Rec.resample('fs_in',Kov*fsym,'fs_out',fsym);
|
||||
|
||||
% Rx_Time_Rec = MaxVar_Timing_Recovery('mode',0,'fsym',fsym,'fadc',Kov*fsym,'num_tau',Kov*128,'sps',Kov,'comp_signal',Rx_tr_mf,'comp_mode',0).process(Rx_matched_1);
|
||||
Rx_Time_Rec = MaxVar_Timing_Recovery('mode',0,'fsym',fsym,'fadc',Kov*fsym,'num_tau',Kov*2048,'sps',Kov,'comp_signal',Rx_tr_mf,'comp_mode',0).process(Rx_matched_1);
|
||||
|
||||
sps = 1;
|
||||
else
|
||||
Rx_Time_Rec = Rx_matched_1;
|
||||
|
||||
sps = 1;
|
||||
end
|
||||
|
||||
@@ -188,7 +189,7 @@ for our_signal = 1
|
||||
end
|
||||
% Rx_synced = Rx_Time_Rec;
|
||||
% Rx_synced = Rx_synced_cell{1};
|
||||
len_tr = 4096*2;
|
||||
len_tr = 4096*4;
|
||||
mu_ffe1 = 0.0001;
|
||||
mu_ffe2 = 0.0008;
|
||||
mu_ffe3 = 0.001;
|
||||
@@ -233,11 +234,12 @@ for our_signal = 1
|
||||
|
||||
%% -------------------- VNLE + MLSE --------------------
|
||||
pf_ncoeffs = 4;
|
||||
eq_v = EQ("Ne",[300, 0, 0],"Nb",[0, 0, 0], ...
|
||||
eq_v = EQ("Ne",[300, 0, 0],"Nb",[2, 0, 0], ...
|
||||
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",sps,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",1, ...
|
||||
'weighted_DFE',0,'weighted_DFE_d_min',0.5,'weighted_DFE_mode','R2','weighted_DFE_I_mode',[5,0.5,0.6]);
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",0, ...
|
||||
'weighted_DFE',1,'weighted_DFE_d_min',0.5,'weighted_DFE_mode','I2','weighted_DFE_I_mode',[1,0.1,0.1], ...
|
||||
'PDFE_coefficient',0.01);
|
||||
% eq_v = FFE_DFE('ffe_order',300,'dfe_order',5,'len_tr',len_tr,'epochs_tr',5,'epochs_dd',5, ...
|
||||
% 'ffe_mu_dd',mu_ffe,'ffe_mu_tr',0,'dfe_mu_dd',mu_dfe,'dfe_mu_tr',0.005,'sps',sps,'decide',0);
|
||||
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
@@ -258,7 +260,7 @@ for our_signal = 1
|
||||
%% -------------------- ML-based MLSE (L=2) --------------------
|
||||
% ml_mlse_equalizer = ML_MLSE("epochs_tr",100,"epochs_dd",1, ...
|
||||
% "len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",11,"sps",sps, ...
|
||||
% "traceback_depth",256,"L",4,"delta",4,"adaptive_mu",0);
|
||||
% "traceback_depth",256,"L",1,"delta",4,"adaptive_mu",0);
|
||||
%
|
||||
% [ml_mlse_results] = ml_mlse(ml_mlse_equalizer, M, Rx_synced, Symbols, Bits,"precode_mode",duob_mode,"eth_style_symbol_mapping",mapping_style);
|
||||
% if our_signal
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
%%
|
||||
x = 225:10:285;
|
||||
averaging_over_signal_traces = 1;
|
||||
all_BER_plots = 0;
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_2_Optimal' + string(k) + '.mat');
|
||||
BER_values = BER.BER_PAM_2;
|
||||
idx_opt = BER.idx_opt;
|
||||
BER_num_signal_sweep_matrix = BER.BER_num_signal_sweep_matrix;
|
||||
disp(idx_opt)
|
||||
|
||||
BER_num_signal_sweep_matrix = BER_num_signal_sweep_matrix(((k-1)*7+1:k*7),:);
|
||||
|
||||
if averaging_over_signal_traces
|
||||
for i = 1:size(BER_values,2)
|
||||
BER_values(i) = mean(BER_num_signal_sweep_matrix(i,:));
|
||||
end
|
||||
end
|
||||
|
||||
if all_BER_plots
|
||||
figure;
|
||||
hold on
|
||||
for i = 1:size(BER_num_signal_sweep_matrix,1)
|
||||
plot(BER_num_signal_sweep_matrix(i,:))
|
||||
end
|
||||
hold off
|
||||
end
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
old_BER = [-1.5, -1.75, -2, -2.3, -2.6, -2.25, -1.95];
|
||||
old_BER = 10.^(old_BER);
|
||||
plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','southwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(221,2.2e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(221,3.3e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(221,5.4e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(231,2.4e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex')
|
||||
ylabel('BER', 'Interpreter','latex')
|
||||
% title('BER for PAM-2', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
ylim([1e-4 5e-1])
|
||||
set(gca,'YScale','log')
|
||||
% beautifyBERplot
|
||||
hold off
|
||||
@@ -0,0 +1,61 @@
|
||||
%%
|
||||
x = 225:10:285;
|
||||
averaging_over_signal_traces = 1;
|
||||
all_BER_plots = 0;
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Optimal' + string(k) + '.mat');
|
||||
BER_values = BER.BER_PAM_4;
|
||||
idx_opt = BER.idx_opt;
|
||||
BER_num_signal_sweep_matrix = BER.BER_num_signal_sweep_matrix;
|
||||
disp(idx_opt)
|
||||
|
||||
BER_num_signal_sweep_matrix = BER_num_signal_sweep_matrix(((k-1)*7+1:k*7),:);
|
||||
|
||||
if averaging_over_signal_traces
|
||||
for i = 1:size(BER_values,2)
|
||||
BER_values(i) = mean(BER_num_signal_sweep_matrix(i,:));
|
||||
end
|
||||
end
|
||||
|
||||
if all_BER_plots
|
||||
figure;
|
||||
hold on
|
||||
for i = 1:size(BER_num_signal_sweep_matrix,1)
|
||||
plot(BER_num_signal_sweep_matrix(i,:))
|
||||
end
|
||||
hold off
|
||||
end
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
old_BER = [-1.6, -1.85, -2.2, -2.45, -2.3, -2, -1.4];
|
||||
old_BER = 10.^(old_BER);
|
||||
plot(x, old_BER, '-o','LineWidth',1.75)
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', 'BER Paper', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','southwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(221,2.2e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(221,3.2e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(221,5.7e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(221,2.5e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Laser Bias Current [mA]', 'Interpreter','latex')
|
||||
ylabel('BER', 'Interpreter','latex')
|
||||
% title('BER for PAM-2', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
ylim([3e-5 5e-1])
|
||||
set(gca,'YScale','log')
|
||||
% beautifyBERplot
|
||||
hold off
|
||||
@@ -0,0 +1,59 @@
|
||||
%%
|
||||
x = 4:1:8;
|
||||
averaging_over_signal_traces = 1;
|
||||
all_BER_plots = 0;
|
||||
for k = 1:4
|
||||
BER = load('C:\Users\magf\Desktop\Desktop\Projekte\FSO\Data\BER_PAM_4_Baud_Rate_Sweep_Optimal_' + string(k) + '.mat');
|
||||
BER_values = BER.BER_PAM_4;
|
||||
idx_opt = BER.idx_opt;
|
||||
BER_num_signal_sweep_matrix = BER.BER_num_signal_sweep_matrix;
|
||||
disp(idx_opt)
|
||||
|
||||
BER_num_signal_sweep_matrix = BER_num_signal_sweep_matrix(((k-1)*5+1:k*5),:);
|
||||
|
||||
if averaging_over_signal_traces
|
||||
for i = 1:size(BER_values,2)
|
||||
BER_values(i) = mean(BER_num_signal_sweep_matrix(i,:));
|
||||
end
|
||||
end
|
||||
|
||||
if all_BER_plots
|
||||
figure;
|
||||
hold on
|
||||
for i = 1:size(BER_num_signal_sweep_matrix,1)
|
||||
plot(BER_num_signal_sweep_matrix(i,:))
|
||||
end
|
||||
hold off
|
||||
end
|
||||
|
||||
figure(202120)
|
||||
plot(x, BER_values, '-o','LineWidth',1.75);
|
||||
hold on
|
||||
end
|
||||
|
||||
h1 = yline(2e-2, ':k', 'LineWidth',1.5);
|
||||
h2 = yline(3.8e-3,':b', 'LineWidth',1.5);
|
||||
h3 = yline(4.85e-3,':g', 'LineWidth',1.5);
|
||||
h4 = yline(2.2e-4,':r', 'LineWidth',1.5);
|
||||
|
||||
% Legende NUR für Kurven
|
||||
legend('FFE', 'FFE+PF+MLSE', 'DB', 'ML-MLSE', ...
|
||||
'Interpreter','latex', ...
|
||||
'Location','southwest', 'FontSize', 14)
|
||||
|
||||
% FEC Labels direkt im Plot
|
||||
text(3.2,2.3e-2,'o-FEC','Color','k','FontSize', 14, 'Interpreter','latex')
|
||||
text(3.2,3e-3,'HD-FEC','Color','b','FontSize', 14, 'Interpreter','latex')
|
||||
text(3.2,5.9e-3,'KP4+Hamming','Color','g','FontSize', 14,'Interpreter','latex')
|
||||
text(3.2,2.7e-4,'KP4','Color','r','FontSize', 14,'Interpreter','latex')
|
||||
|
||||
xlabel('Symbol Rate [GBd]', 'Interpreter','latex')
|
||||
ylabel('BER', 'Interpreter','latex')
|
||||
% title('BER for PAM-2', 'Interpreter','latex')
|
||||
|
||||
grid minor
|
||||
xlim([3 9])
|
||||
ylim([5e-7 5e-1])
|
||||
set(gca,'YScale','log')
|
||||
% beautifyBERplot
|
||||
hold off
|
||||
@@ -212,40 +212,40 @@ for our_signal = 1
|
||||
% end
|
||||
|
||||
%% -------------------- VNLE + MLSE --------------------
|
||||
pf_ncoeffs = 4;
|
||||
eq_v = EQ("Ne",[300, 0, 0],"Nb",[0, 0, 0], ...
|
||||
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",sps,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",1, ...
|
||||
'weighted_DFE',0,'weighted_DFE_d_min',0.5,'weighted_DFE_mode','R2','weighted_DFE_I_mode',[5,0.5,0.6]);
|
||||
% eq_v = FFE_DFE('ffe_order',300,'dfe_order',5,'len_tr',len_tr,'epochs_tr',5,'epochs_dd',5, ...
|
||||
% 'ffe_mu_dd',mu_ffe,'ffe_mu_tr',0,'dfe_mu_dd',mu_dfe,'dfe_mu_tr',0.005,'sps',sps,'decide',0);
|
||||
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0,"eth_style",mapping_style).levels);
|
||||
|
||||
[vnle_results, mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Rx_synced, Symbols, Bits, ...
|
||||
"precode_mode", duob_mode, 'showAnalysis', 1, "postFFE", [], "eth_style_symbol_mapping", mapping_style);
|
||||
|
||||
mlse_results.metrics.print
|
||||
if our_signal
|
||||
fprintf('Our Signal: %.1e \n',mlse_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
else
|
||||
fprintf('Their Signal: %.1e \n',mlse_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
end
|
||||
|
||||
%% -------------------- ML-based MLSE (L=2) --------------------
|
||||
% ml_mlse_equalizer = ML_MLSE("epochs_tr",100,"epochs_dd",1, ...
|
||||
% "len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",11,"sps",sps, ...
|
||||
% "traceback_depth",256,"L",4,"delta",4,"adaptive_mu",0);
|
||||
% pf_ncoeffs = 4;
|
||||
% eq_v = EQ("Ne",[300, 0, 0],"Nb",[0, 0, 0], ...
|
||||
% "training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
% "K",sps,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
|
||||
% "FFEmu",0,"plotfinal",0,"ideal_dfe",1, ...
|
||||
% 'weighted_DFE',0,'weighted_DFE_d_min',0.5,'weighted_DFE_mode','R2','weighted_DFE_I_mode',[5,0.5,0.6]);
|
||||
% % eq_v = FFE_DFE('ffe_order',300,'dfe_order',5,'len_tr',len_tr,'epochs_tr',5,'epochs_dd',5, ...
|
||||
% % 'ffe_mu_dd',mu_ffe,'ffe_mu_tr',0,'dfe_mu_dd',mu_dfe,'dfe_mu_tr',0.005,'sps',sps,'decide',0);
|
||||
% pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
% mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0,"eth_style",mapping_style).levels);
|
||||
%
|
||||
% [ml_mlse_results] = ml_mlse(ml_mlse_equalizer, M, Rx_synced, Symbols, Bits,"precode_mode",duob_mode,"eth_style_symbol_mapping",mapping_style);
|
||||
% [vnle_results, mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Rx_synced, Symbols, Bits, ...
|
||||
% "precode_mode", duob_mode, 'showAnalysis', 1, "postFFE", [], "eth_style_symbol_mapping", mapping_style);
|
||||
%
|
||||
% mlse_results.metrics.print
|
||||
% if our_signal
|
||||
% fprintf('Our Signal: %.1e \n',ml_mlse_results.metrics.BER);
|
||||
% fprintf('Our Signal: %.1e \n',mlse_results.metrics.BER);
|
||||
% fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
% else
|
||||
% fprintf('Their EQ: %.1e \n',ml_mlse_results.metrics.BER);
|
||||
% fprintf('Their Signal: %.1e \n',mlse_results.metrics.BER);
|
||||
% fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
% end
|
||||
|
||||
%% -------------------- ML-based MLSE (L=2) --------------------
|
||||
ml_mlse_equalizer = ML_MLSE("epochs_tr",150,"epochs_dd",1, ...
|
||||
"len_tr",length(Rx_synced),"mu_dd",0.03,"mu_tr",0.03,"order",210,"sps",sps, ...
|
||||
"traceback_depth",256,"L",1,"delta",4,"adaptive_mu",0);
|
||||
|
||||
[ml_mlse_results] = ml_mlse(ml_mlse_equalizer, M, Rx_synced, Symbols, Bits,"precode_mode",duob_mode,"eth_style_symbol_mapping",mapping_style);
|
||||
if our_signal
|
||||
fprintf('Our Signal: %.1e \n',ml_mlse_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
else
|
||||
fprintf('Their EQ: %.1e \n',ml_mlse_results.metrics.BER);
|
||||
fprintf('Paper: %.1e \n \n',ber_in_paper);
|
||||
end
|
||||
end
|
||||
@@ -2,7 +2,7 @@ dsp_options.storage_path = 'Z:\2024\sioe_labor\';
|
||||
dsp_options.max_occurences = 1;
|
||||
database = DBHandler("dataBase", 'labor_highspeed', "type", 'mysql' );
|
||||
|
||||
rates = [300e9];
|
||||
rates = [420e9];
|
||||
cols = cbrewer2('BuPu',25);
|
||||
cols = [cols(end-10:2:end,:)];
|
||||
cols = cbrewer2('Set1',6);
|
||||
@@ -10,7 +10,7 @@ cols = cbrewer2('Set1',6);
|
||||
fignum = 200;
|
||||
fig=figure(fignum);clf;
|
||||
|
||||
for dbmode = 0:1%length(rates)
|
||||
for dbmode = 1%length(rates)
|
||||
|
||||
|
||||
if 0
|
||||
@@ -59,8 +59,8 @@ for dbmode = 0:1%length(rates)
|
||||
M = 4;
|
||||
fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
fp.where('Runs', 'bitrate','EQUALS', rates);%360,390
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 10);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1322.7); %1327.4
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1310); %1327.4
|
||||
fp.where('Runs', 'db_mode','EQUALS', dbmode);
|
||||
fp.where('Runs', 'rop_attenuation','EQUAL', 0);
|
||||
|
||||
@@ -85,7 +85,7 @@ for dbmode = 0:1%length(rates)
|
||||
|
||||
%%% 4) Plot RX Signal
|
||||
Scpe_sig.spectrum("fignum",fignum+dbmode,"normalizeTo0dB",1,"displayname",'Rx','addDCoffset',1,'color',[0,0,0],'normalizeToNyquist',0,'linestyle',':');
|
||||
Scpe_sig.eye(fsym,M,"fignum",47,"displayname",' Eye of AVG Signal');
|
||||
Scpe_sig.eye(fsym,M,"fignum",47,"displayname",' Eye of AVG Signal');
|
||||
% xline(Symbols.fs/2.*1e-9,'Color',cols(r,:),'HandleVisibility','off');
|
||||
|
||||
average_signals = 1;
|
||||
@@ -98,7 +98,10 @@ Scpe_sig.eye(fsym,M,"fignum",47,"displayname",' Eye of AVG Signal');
|
||||
scope_mean = scope_mean ./ n;
|
||||
Scpe_sig_avg.signal = scope_mean;
|
||||
|
||||
Scpe_sig_avg.spectrum("displayname","Scope PSD","fignum",20,"normalizeTo0dB",1);
|
||||
figure(20);hold on
|
||||
Symbols.spectrum("fignum",20,"normalizeTo0dB",1,"displayname",'Full Response','addDCoffset',0,'color',clr.Set1.red,'normalizeToNyquist',0,'linestyle','--');
|
||||
DB_Symbols.spectrum("fignum",20,"normalizeTo0dB",1,"displayname",'DB-Response','addDCoffset',0,'color',clr.Set1.blue,'normalizeToNyquist',0,'linestyle','--');
|
||||
Scpe_sig_avg.spectrum("displayname","Scope PSD","fignum",20,"normalizeTo0dB",1,"addDCoffset",5);
|
||||
Scpe_sig_avg.plot("displayname","Scope raw signal","fignum",27,"clear",1);
|
||||
Scpe_sig_avg.eye(fsym,M,"fignum",48,"displayname",' Eye of AVG Signal');
|
||||
end
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
%% Main Script: Compare Bibliographies
|
||||
% This script loads two .bbl files, parses them into tables, and compares
|
||||
% them to find missing citations and duplicates.
|
||||
|
||||
clc; clear; close all;
|
||||
|
||||
% --- STEP 0: Create Dummy Files for Demonstration ---
|
||||
% (You can remove this step if you have actual files on disk)
|
||||
|
||||
file1 = 'C:\Users\Silas\Documents\latex\JLT_400G_submission\Advanced_DSP_for_400G_IMDD.bbl'; % The file based on your input
|
||||
file2 = 'C:\Users\Silas\Documents\latex\JLT_400G_submission\Advanced_DSP_for_400G_IMDD_v1.bbl'; % A modified version to show differences
|
||||
|
||||
% --- STEP 1: Load and Parse Files ---
|
||||
fprintf('Loading files...\n');
|
||||
try
|
||||
tab1 = parse_bbl_file(file1);
|
||||
tab2 = parse_bbl_file(file2);
|
||||
catch ME
|
||||
error('Error loading files: %s', ME.message);
|
||||
end
|
||||
|
||||
fprintf('File 1 (%s): %d citations found.\n', file1, height(tab1));
|
||||
fprintf('File 2 (%s): %d citations found.\n', file2, height(tab2));
|
||||
disp('------------------------------------------------------------');
|
||||
|
||||
% --- STEP 2: Check for Duplicates within files ---
|
||||
check_duplicates(tab1, file1);
|
||||
check_duplicates(tab2, file2);
|
||||
disp('------------------------------------------------------------');
|
||||
|
||||
% --- STEP 3: Compare Files (Set Differences) ---
|
||||
% Find keys in A that are NOT in B
|
||||
[~, idx1] = setdiff(tab1.Key, tab2.Key);
|
||||
missing_in_B = tab1(idx1, :);
|
||||
|
||||
% Find keys in B that are NOT in A
|
||||
[~, idx2] = setdiff(tab2.Key, tab1.Key);
|
||||
missing_in_A = tab2(idx2, :);
|
||||
|
||||
% --- STEP 4: Display Comparison Results ---
|
||||
|
||||
if isempty(missing_in_B)
|
||||
fprintf('All citations from %s are present in %s.\n', file1, file2);
|
||||
else
|
||||
fprintf('Citations in %s but MISSING in %s (%d):\n', file1, file2, height(missing_in_B));
|
||||
disp(missing_in_B.Key);
|
||||
end
|
||||
fprintf('\n');
|
||||
|
||||
if isempty(missing_in_A)
|
||||
fprintf('All citations from %s are present in %s.\n', file2, file1);
|
||||
else
|
||||
fprintf('Citations in %s but MISSING in %s (%d):\n', file2, file1, height(missing_in_A));
|
||||
disp(missing_in_A.Key);
|
||||
end
|
||||
|
||||
%% ---------------------------------------------------------
|
||||
% HELPER FUNCTIONS
|
||||
% ---------------------------------------------------------
|
||||
|
||||
function check_duplicates(T, filename)
|
||||
% Checks if the 'Key' column has non-unique entries
|
||||
[uKeys, ~, idx] = unique(T.Key);
|
||||
counts = accumarray(idx, 1);
|
||||
|
||||
dup_indices = find(counts > 1);
|
||||
|
||||
if isempty(dup_indices)
|
||||
fprintf('No duplicates found in %s.\n', filename);
|
||||
else
|
||||
fprintf('** WARNING: Duplicates found in %s! **\n', filename);
|
||||
for i = 1:length(dup_indices)
|
||||
key_idx = dup_indices(i);
|
||||
fprintf(' Key "%s" appears %d times.\n', uKeys{key_idx}, counts(key_idx));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function bibTable = parse_bbl_file(filename)
|
||||
% PARSE_BBL_FILE Loads a .bbl file and extracts citations using Regex.
|
||||
%
|
||||
% bibTable = PARSE_BBL_FILE(filename) returns a table with columns:
|
||||
% - Key: The citation key (e.g., 'dambrosiaAug2025Progress')
|
||||
% - RawContent: The full text of the citation entry
|
||||
% - Line: Approximate line number where it starts
|
||||
|
||||
% 1. Read the file content
|
||||
if ~isfile(filename)
|
||||
error('File "%s" not found.', filename);
|
||||
end
|
||||
str = fileread(filename);
|
||||
|
||||
% 2. Define Regex Structure
|
||||
% Explanation:
|
||||
% \\bibitem\{ -> Match literal "\bibitem{"
|
||||
% (?<Key>[^}]+) -> Capture Group 'Key': match anything except '}'
|
||||
% \} -> Match literal "}"
|
||||
% \s* -> Match optional whitespace
|
||||
% (?<Content>.*?) -> Capture Group 'Content': match any character lazily...
|
||||
% (?=(\\bibitem|\\end\{thebibliography\})) -> ...until looking ahead sees "\bibitem" or end of env.
|
||||
|
||||
% Note: 'dotexceptnewline' is usually default, but we need dot to match newlines
|
||||
% for multi-line citations. We handle this using the '(?s)' flag or explicit loop.
|
||||
% Here we use standard pattern matching.
|
||||
|
||||
pattern = '\\bibitem\{(?<Key>[^}]+)\}\s*(?<Content>.*?)(?=(\\bibitem|\\end\{thebibliography\}))';
|
||||
|
||||
% 3. Execute Regex
|
||||
% 'warnings' turned off for empty matches if file is malformed
|
||||
[matches] = regexp(str, pattern, 'names');
|
||||
|
||||
% 4. Convert to Table
|
||||
if isempty(matches)
|
||||
warning('No citations found in %s using standard regex.', filename);
|
||||
bibTable = table({}, {}, 'VariableNames', {'Key', 'RawContent'});
|
||||
return;
|
||||
end
|
||||
|
||||
% Clean up content (remove leading/trailing spaces/newlines)
|
||||
keys = {matches.Key}';
|
||||
content = {matches.Content}';
|
||||
content = strtrim(content);
|
||||
|
||||
bibTable = table(keys, content, 'VariableNames', {'Key', 'RawContent'});
|
||||
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
% === SETTINGS ===
|
||||
dsp_options.append_to_db = 1;
|
||||
dsp_options.append_to_db = 0;
|
||||
dsp_options.max_occurences = 1;
|
||||
|
||||
experiment = "highspeed_2024";
|
||||
@@ -14,7 +14,7 @@ if dsp_options.mode == "load_run_id"
|
||||
dsp_options.dataBase = 'labor_highspeed';%'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\silas_labor_newdsp_newstructure.db';
|
||||
dsp_options.storage_path = 'Z:\2024\sioe_labor\';
|
||||
db = DBHandler("dataBase", [dsp_options.dataBase],...
|
||||
"type", dsp_options.database_type,"server","192.168.178.192","user","silas","password","silas");
|
||||
"type", dsp_options.database_type,"server","134.245.243.254","user","silas","password","silas");
|
||||
|
||||
elseif experiment == "mpi_ecoc_2025"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
dsp_options.storage_path = 'Z:\2024\sioe_labor\';
|
||||
dsp_options.max_occurences = 1;
|
||||
db = DBHandler("dataBase", 'labor_highspeed', "type", 'mysql' );
|
||||
db = DBHandler("dataBase", 'labor_highspeed', "type", 'mysql','server','134.245.243.254','password','silas','user','silas');
|
||||
|
||||
% fp = QueryFilter();
|
||||
%
|
||||
|
||||
Binary file not shown.
@@ -4,11 +4,11 @@ if 1
|
||||
|
||||
uloops = struct;
|
||||
uloops.precomp = [1];
|
||||
uloops.bitrate = [300].*1e9; %[300,330,360,390,420,450,480] [224,336,360,390,420,448] for MPI
|
||||
uloops.bitrate = [360].*1e9; %[300,330,360,390,420,450,480] [224,336,360,390,420,448] for MPI
|
||||
% uloops.laser_wavelength = [1293,1297.5,1302,1306.5,1310,1313.4,1318,1322.7,1327.4];
|
||||
uloops.laser_wavelength = [1293];
|
||||
uloops.laser_wavelength = [1290];
|
||||
uloops.M = [4];
|
||||
uloops.link_length = [0:2:10]; % 1,2,3,5,6,8,10
|
||||
uloops.link_length = [0]; % 1,2,3,5,6,8,10
|
||||
uloops.alpha = [0];
|
||||
|
||||
wh = DataStorage(uloops);
|
||||
@@ -19,21 +19,23 @@ if 1
|
||||
end
|
||||
|
||||
%%
|
||||
figure
|
||||
hold on
|
||||
for alpha = uloops.alpha
|
||||
a=wh.getStoValue('ber',1, [300].*1e9 , 1293, 4, uloops.link_length,alpha);
|
||||
ffe = cellfun(@(x) x.ffe_results.metrics.BER, a);
|
||||
plot(uloops.link_length,ffe,'DisplayName',sprintf('Alpha: %d',alpha),'LineStyle','-','HandleVisibility','on');
|
||||
end
|
||||
|
||||
set(gca, 'YScale', 'log');
|
||||
ylim([5e-5 0.4]);
|
||||
yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
legend
|
||||
beautifyBERplot()
|
||||
ylabel('BER');
|
||||
|
||||
% figure
|
||||
% hold on
|
||||
%
|
||||
% a=wh.getStoValue('ber',1, [360].*1e9 , 1290, 4, uloops.link_length,alpha);
|
||||
% ffe = cellfun(@(x) x.ffe_results.metrics.BER, a);
|
||||
% plot(uloops.link_length,ffe,'DisplayName',sprintf('FFE'),'LineStyle','-','HandleVisibility','on');
|
||||
% dbt = cellfun(@(x) x.dbt_results.metrics.BER, a);
|
||||
% plot(uloops.link_length,dbt,'DisplayName',sprintf('DBt'),'LineStyle','-','HandleVisibility','on');
|
||||
%
|
||||
%
|
||||
% set(gca, 'YScale', 'log');
|
||||
% ylim([5e-5 0.4]);
|
||||
% yline([3.8e-3, 2e-2],'HandleVisibility','off');
|
||||
% legend
|
||||
% beautifyBERplot()
|
||||
% ylabel('BER');
|
||||
%
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,66 +3,59 @@ function [output] = imdd_model(varargin)
|
||||
simulation_mode = 1;
|
||||
|
||||
%%% Change folder
|
||||
curFolder = pwd;
|
||||
funcFolder=fileparts(mfilename('fullpath'));
|
||||
if ~isempty(funcFolder)
|
||||
cd(funcFolder);
|
||||
end
|
||||
% curFolder = pwd;
|
||||
% funcFolder=fileparts(mfilename('fullpath'));
|
||||
% if ~isempty(funcFolder)
|
||||
% cd(funcFolder);
|
||||
% end
|
||||
|
||||
%%% Run parameters
|
||||
% TX
|
||||
M = 4;
|
||||
fsym = 180e9;
|
||||
|
||||
apply_pulsef = 1;
|
||||
fdac = 256e9;
|
||||
fadc = 256e9;
|
||||
% --- TX Architecture ---
|
||||
M = 4; % PAM order
|
||||
fsym = 180e9; % Symbol rate
|
||||
apply_pulsef = 1; % Pulse shaping flag
|
||||
fdac = 256e9; % DAC sampling rate
|
||||
fadc = 256e9; % ADC sampling rate
|
||||
random_key = 1;
|
||||
rcalpha = 0.05; % Roll-off factor
|
||||
kover = 16; % Oversampling factor
|
||||
duob_mode = db_mode.db_precoded;
|
||||
|
||||
rcalpha = 0.05;
|
||||
kover = 16;
|
||||
|
||||
% --- TX Optics (EML / Laser) ---
|
||||
vbias_rel = 0.5;
|
||||
u_pi = 3;
|
||||
vbias = -vbias_rel*u_pi;
|
||||
|
||||
vbias = -vbias_rel * u_pi;
|
||||
laser_wavelength = 1293;
|
||||
laser_linewidth = 0;
|
||||
tx_bw_nyquist = 0.8;
|
||||
|
||||
% Channel
|
||||
% --- Channel ---
|
||||
link_length = 1;
|
||||
alpha = 0;
|
||||
|
||||
% RX
|
||||
rop = -8;
|
||||
% --- RX & Equalization ---
|
||||
rop = -2;
|
||||
rx_bw_nyquist = 0.8;
|
||||
len_tr = 4096 * 2;
|
||||
|
||||
% VNLE / FFE / DFE Orders
|
||||
vnle_order1 = 50;
|
||||
vnle_order2 = 7;
|
||||
vnle_order3 = 7;
|
||||
|
||||
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
||||
dfe_order = [0 0 0];
|
||||
vnle_order = [vnle_order1, vnle_order2, vnle_order3];
|
||||
dfe_order = [0, 0, 0];
|
||||
dfe_ = sum(dfe_order) > 0;
|
||||
|
||||
pf_ncoeffs = 1;
|
||||
|
||||
alpha = 0;
|
||||
|
||||
len_tr = 4096*2;
|
||||
|
||||
% Equalizer Step Sizes
|
||||
mu_ffe1 = 0.0001;
|
||||
mu_ffe2 = 0.0008;
|
||||
mu_ffe3 = 0.001;
|
||||
mu_dc = 0.005;
|
||||
% mu_dc = 0;
|
||||
|
||||
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
|
||||
mu_ffe = [mu_ffe1, mu_ffe3, mu_ffe3];
|
||||
mu_dfe = 0.0004;
|
||||
|
||||
|
||||
dfe_ = sum(dfe_order)>0;
|
||||
|
||||
duob_mode = db_mode.no_db;
|
||||
mu_dc = 0.005;
|
||||
|
||||
%%% change specific parameter if given in varargin
|
||||
% Parse optional input arguments
|
||||
@@ -109,12 +102,12 @@ Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",1
|
||||
'duobinary_mode',duob_mode,...
|
||||
"mrds_code",0,"mrds_blocklength",512).process();
|
||||
|
||||
Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||
% Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||
|
||||
%%%%% AWG
|
||||
% El_sig = M8199A("kover",kover).process(Digi_sig);
|
||||
El_sig = AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",1).process(Digi_sig);
|
||||
% El_sig.spectrum("displayname",'Digi Spectrum','fignum',100,'normalizeTo0dB',0);
|
||||
El_sig.spectrum("displayname",'Digi Spectrum','fignum',100,'normalizeTo0dB',1);
|
||||
% El_sig = El_sig.setPower(0,"dBm");
|
||||
|
||||
%%%%% Low-pass el. components %%%%%%
|
||||
@@ -132,7 +125,7 @@ El_sig = El_sig .* scaling;
|
||||
%%%%% MODULATE E/O CONVERSION %%%%%%
|
||||
[Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",laser_wavelength,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",random_key+1,"alpha",alpha).process(El_sig);
|
||||
|
||||
Opt_sig.spectrum("displayname",'Opt Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||
% Opt_sig.spectrum("displayname",'Opt Spectrum','fignum',10,'normalizeTo0dB',1);
|
||||
|
||||
Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig);
|
||||
|
||||
@@ -150,7 +143,6 @@ Rx_sig = Filter('filtdegree',4,"f_cutoff",rx_bwl,"fs",fdac*kover,"filterType",fi
|
||||
% %%%%%% Low-pass Scope %%%%%%
|
||||
Lp_scpe = Filter('filtdegree',4,"f_cutoff",110e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true);
|
||||
|
||||
% Rx_sig.spectrum("displayname",'Analog Rx Spectrum','fignum',100,'normalizeTo0dB',1);
|
||||
|
||||
%%%%%% Scope %%%%%%
|
||||
Scpe_sig = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
@@ -165,15 +157,18 @@ Scpe_sig = Scpe_sig.resample("fs_out",2*fsym);
|
||||
Scpe_sig.signal = Scpe_sig.signal(1:2*length(Symbols));
|
||||
|
||||
%%%%%% Sync Rx signal with reference %%%%%%
|
||||
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",1);
|
||||
[Scpe_sig,~] = Scpe_sig.tsynch("reference",Symbols,"fs_ref",fsym,"debug_plots",0);
|
||||
|
||||
Scpe_sig = Filter('filtdegree',4,"f_cutoff",Symbols.fs.*0.5,"fs",Scpe_sig.fs,"filterType",filtertypes.gaussian,"active",true).process(Scpe_sig);
|
||||
|
||||
Scpe_sig = Scpe_sig - mean(Scpe_sig.signal);
|
||||
|
||||
Scpe_sig.spectrum("displayname",'Filtered Digital Spectrum','fignum',100,'normalizeTo0dB',1);
|
||||
|
||||
|
||||
%%% EQUALIZING
|
||||
|
||||
|
||||
if 0
|
||||
% -------------------- FFE --------------------
|
||||
ffe_order = [50, 0, 0];
|
||||
eq_ffe = EQ("Ne",ffe_order,"Nb",[0,0,0], ...
|
||||
@@ -186,7 +181,8 @@ output.ffe_results = ffe(eq_ffe,M,Scpe_sig,Symbols,Tx_bits, ...
|
||||
"eth_style_symbol_mapping",0);
|
||||
|
||||
output.ffe_results.metrics.print
|
||||
|
||||
end
|
||||
if 0
|
||||
% -------------------- DFE --------------------
|
||||
eq_dfe = EQ("Ne",ffe_order,"Nb",[2,0,0], ...
|
||||
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
@@ -198,33 +194,36 @@ output.dfe_results = ffe(eq_dfe,M,Scpe_sig,Symbols,Tx_bits, ...
|
||||
"eth_style_symbol_mapping",0);
|
||||
|
||||
output.dfe_results.metrics.print("description",'DFE');
|
||||
end
|
||||
if 0
|
||||
|
||||
|
||||
% -------------------- VNLE + MLSE --------------------
|
||||
pf_ncoeffs = 1;
|
||||
ffe_order3 = [50, 5, 5];
|
||||
eq_v = EQ("Ne",ffe_order3,"Nb",dfe_order, ...
|
||||
% -------------------- VNLE + MLSE --------------------
|
||||
pf_ncoeffs = 1;
|
||||
ffe_order3 = [50, 5, 5];
|
||||
eq_v = EQ("Ne",ffe_order3,"Nb",dfe_order, ...
|
||||
"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005, ...
|
||||
"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
||||
|
||||
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
||||
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
||||
|
||||
[output.vnle_results, output.mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||
[output.vnle_results, output.mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||
"precode_mode", duob_mode, 'showAnalysis', 0, "postFFE", [], "eth_style_symbol_mapping", 0);
|
||||
output.mlse_results.metrics.print("description",'MLSE');
|
||||
end
|
||||
if 1
|
||||
|
||||
%% -------------------- DB target --------------------
|
||||
mlse_db_ = MLSE("DIR",[1,1],"duobinary_output",0,"M",M,'trellis_states',PAMmapper(M,0).levels);
|
||||
ffe_order = [50, 5, 5];
|
||||
eq_ = EQ("Ne",ffe_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1,"DB_aim",0);
|
||||
output.dbt_results = duobinary_target(eq_,mlse_db_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||
"precode_mode", duob_mode, 'showAnalysis', 1, "postFFE", [],"decoding_mode","memoryless");
|
||||
|
||||
% -------------------- DB target --------------------
|
||||
mlse_db_ = MLSE("DIR",[1,1],"duobinary_output",0,"M",M,'trellis_states',PAMmapper(M,0).levels);
|
||||
ffe_order = [50, 5, 5];
|
||||
eq_ = EQ("Ne",ffe_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5, ...
|
||||
"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||
output.dbt_results = duobinary_target(eq_,mlse_db_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||
"precode_mode", duob_mode, 'showAnalysis', 0, "postFFE", []);
|
||||
|
||||
output.dbt_results.metrics.print("description",'Duobinary');
|
||||
|
||||
output.dbt_results.metrics.print("description",'Duobinary');
|
||||
end
|
||||
|
||||
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ')
|
||||
fprintf('\n')
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
% minimal example IM/DD
|
||||
|
||||
M = 4;
|
||||
fsym = 180e9;
|
||||
fsym = 112e9;
|
||||
|
||||
apply_pulsef = 1;
|
||||
fdac = 256e9;
|
||||
fadc = 256e9;
|
||||
random_key = 1;
|
||||
|
||||
rcalpha = 0.6;
|
||||
rcalpha = 0.05;
|
||||
kover = 16;
|
||||
|
||||
duob_mode = db_mode.no_db;
|
||||
@@ -63,9 +63,11 @@ Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"al
|
||||
"mrds_code",0,"mrds_blocklength",512).process();
|
||||
|
||||
%%%%% AWG
|
||||
El_sig = M8199A("kover",kover).process(Digi_sig);
|
||||
% El_sig = AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",1).process(Digi_sig);
|
||||
% El_sig = M8199A("kover",kover).process(Digi_sig);
|
||||
El_sig = AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",1).process(Digi_sig);
|
||||
El_sig.spectrum("displayname",'Digi Spectrum','fignum',1,'normalizeTo0dB',1);
|
||||
xlim([0,130]);
|
||||
ylim([-30,5]);
|
||||
% El_sig = El_sig.setPower(0,"dBm");
|
||||
|
||||
%%%%% Electrical Driver Amplifier %%%%%%
|
||||
@@ -144,7 +146,7 @@ output.ffe_results = ffe(eq_,M,Scpe_sig,Symbols,Tx_bits, ...
|
||||
"precode_mode",duob_mode,'showAnalysis',1,"postFFE",[], ...
|
||||
"eth_style_symbol_mapping",0);
|
||||
|
||||
output.ffe_results.metrics.print
|
||||
output.ffe_results.metrics.print("description",'DFE');
|
||||
|
||||
%%
|
||||
|
||||
@@ -162,7 +164,7 @@ mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
||||
[output.vnle_results, output.mlse_results] = vnle_postfilter_mlse(eq_v, pf_, mlse_, M, Scpe_sig, Symbols, Tx_bits, ...
|
||||
"precode_mode", duob_mode, 'showAnalysis', 1, "postFFE", [], "eth_style_symbol_mapping", 0);
|
||||
|
||||
output.mlse_results.metrics.print
|
||||
output.mlse_results.metrics.print("description",'MLSE');
|
||||
|
||||
%%
|
||||
|
||||
|
||||
@@ -58,11 +58,14 @@ if options.parallel
|
||||
updateWaitbarFutures = afterEach(results, updateWaitbar, 0);
|
||||
afterAll(updateWaitbarFutures, @(~) delete(h), 0);
|
||||
|
||||
%%% 7) Fetch final results after all computations
|
||||
fetchOutputs(results);
|
||||
|
||||
for ridx = 1:length(results)
|
||||
wh.addValueToStorageByLinIdx(results(ridx).OutputArguments{1}, 'ber', ridx);
|
||||
%%% 7) Fetch final results iteratively as they finish
|
||||
for i = 1:length(results)
|
||||
try
|
||||
[ridx, result] = fetchNext(results);
|
||||
wh.addValueToStorageByLinIdx(result, 'ber', ridx);
|
||||
catch ME
|
||||
fprintf('A job failed or could not be fetched. Error: %s\n', ME.message);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
BIN
projects/Messung_Zürich/testSilas.mat
Normal file
BIN
projects/Messung_Zürich/testSilas.mat
Normal file
Binary file not shown.
@@ -4,7 +4,7 @@ freqresp = ChannelFreqResp("Nacq",1024,"Navg",64,"Ncp",70,"f_ref",256e9);
|
||||
%
|
||||
Digi_sig = freqresp.buildOFDM();
|
||||
|
||||
Digi_sig.spectrum("fignum",1112,"displayname",['maxamp:',num2str(maxamp)]);
|
||||
Digi_sig.spectrum("fignum",1112);
|
||||
|
||||
Digi_sig = Filter('filtdegree',3,"f_cutoff",70e9,"fs",256e9,"filterType",filtertypes.butterworth,"active",true).process(Digi_sig);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
M = 6;
|
||||
apply_precode = 1;
|
||||
M = 4;
|
||||
apply_precode = 0;
|
||||
|
||||
bitpattern = [];
|
||||
s = RandStream('twister','Seed',1);
|
||||
@@ -51,6 +51,8 @@ disp(['BER: ',sprintf('%.1E',ber),' - - PAM-',num2str(M)]);
|
||||
figure(200)
|
||||
clf
|
||||
hold on
|
||||
start = 100;
|
||||
burstwidth = 10;
|
||||
idxs = start-10:start+burstwidth+10;
|
||||
scatter(idxs,d.signal(idxs),'DisplayName',['Orig Signal'],'Marker','o');
|
||||
scatter(idxs,d_burst.signal(idxs),'DisplayName',['Error Signal'],'Marker','x');
|
||||
|
||||
47
test/m2tikz_examples.m
Normal file
47
test/m2tikz_examples.m
Normal file
@@ -0,0 +1,47 @@
|
||||
x = -10:2:25; % Input power [dBm]
|
||||
|
||||
y1 = 1e-5 * 10.^(0.12*x); % Dispersion-only
|
||||
y2 = 1e0 ./ (1 + exp(-0.4*(x-12))); % NLPN
|
||||
y3 = 1e-6 * 10.^(0.45*x); % RP on gamma
|
||||
y4 = 1e-2 * 10.^(0.18*(x-8)); % RP on beta2
|
||||
|
||||
cmap = WesPalette.AsteroidCity1.rgb(4);
|
||||
cmap = linspecer(4);
|
||||
figure1=figure(202998);clf;hold on
|
||||
lw = 0.8; ms = 3;
|
||||
plot(x,y1,'LineWidth',lw,'Color',cmap(1,:),'Marker','o','MarkerEdgeColor',cmap(1,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
plot(x,y2,'LineWidth',lw,'Color',cmap(2,:),'Marker','square','MarkerEdgeColor',cmap(2,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
plot(x,y3,'LineWidth',lw,'Color',cmap(3,:),'Marker','o','MarkerEdgeColor',cmap(3,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
plot(x,y4,'LineWidth',lw,'Color',cmap(4,:),'Marker','o','MarkerEdgeColor',cmap(4,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
yline(3.8e-3,'HandleVisibility','off')
|
||||
|
||||
grid on
|
||||
xlabel('Input power [dBm]')
|
||||
ylabel('NSD ($\%$)')
|
||||
legend({'Dispersion','NLPN','RP','RP on $\beta_2$'}, ...
|
||||
'Location','best')
|
||||
|
||||
grid off
|
||||
set(gca,'MinorGridLineWidth',0.5);
|
||||
set(gca,'GridLineWidth',0.5,'GridLineStyle','--','GridColor',[0.9,0.9,0.9]);
|
||||
|
||||
set(gca,'FontSize',12,'YScale','log');
|
||||
ylim([1e-6 1e3])
|
||||
xlim([-10 23])
|
||||
|
||||
|
||||
|
||||
fig_path = 'C:\Users\Silas\Documents\Dissertation\00_Examples\tikz\textfig.tikz';
|
||||
matlab2tikz(fig_path, ...
|
||||
'width','\fwidth', ...
|
||||
'height','\fheight', ...
|
||||
'showInfo',false, ...
|
||||
'extraAxisOptions',{ ...
|
||||
'legend style={font=\footnotesize}', ...
|
||||
'xlabel style={font=\color{white!15!black},font=\small},',...
|
||||
'ylabel style={font=\color{white!15!black},font=\small},',...
|
||||
'legend columns=1', ...
|
||||
'every axis/.append style={font=\scriptsize}',...
|
||||
'legend columns=2',...
|
||||
'legend style={at={(0.02,0.98)},font=\footnotesize,draw=black!60,rounded corners=2pt,inner sep=1pt,fill=white,column sep=6pt,anchor= north west}',...
|
||||
});
|
||||
75
test/memoryless_decoding.m
Normal file
75
test/memoryless_decoding.m
Normal file
@@ -0,0 +1,75 @@
|
||||
% einstellungen
|
||||
M = 4;
|
||||
apply_precode_at_tx = 0;
|
||||
emulate_precode = 1;
|
||||
|
||||
% daten erzeugen
|
||||
bitpattern = [];
|
||||
s = RandStream('twister','Seed',1);
|
||||
for i = 1:log2(M)
|
||||
N = 2^(17-1); %length of prbs
|
||||
bitpattern(:,i) = randi(s,[0 1], N, 1);
|
||||
end
|
||||
|
||||
if M == 6
|
||||
bitpattern = reshape(bitpattern',[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
end
|
||||
|
||||
tx_bits = Informationsignal(bitpattern);
|
||||
tx_symbols = PAMmapper(M,0).map(tx_bits);
|
||||
|
||||
if apply_precode_at_tx
|
||||
|
||||
tx_symbols = Duobinary().precode(tx_symbols);
|
||||
|
||||
if emulate_precode
|
||||
% ansatz 1B) Omit precode (einfach precoded empfangen, nichts weiter machen und normal prozessieren - möglich weil konstellation sich nicht ändert)
|
||||
rx_symbols = tx_symbols;
|
||||
bits_rx = PAMmapper(M,0).demap(rx_symbols);
|
||||
% beachten, dass man die tx_bits anpassen muss, da man ja mit precoded symbolen vergleicht
|
||||
tx_bits = PAMmapper(M,0).demap(tx_symbols);
|
||||
else
|
||||
% ansatz 1A) Precode normal:
|
||||
% Entschiedene Symbole codieren: d_DB(n) = d(n) + d(n-1) (im Fall von PAM4 7 level [0 1 2 3 4 5 6])
|
||||
symbols_db = Duobinary().encode(tx_symbols);
|
||||
% Entschiedene codierte Symbole decodieren: d_dec(n) = d_DB(n) mod4
|
||||
rx_symbols = Duobinary().decode(symbols_db);
|
||||
bits_rx = PAMmapper(M,0).demap(rx_symbols);
|
||||
end
|
||||
|
||||
[~,~,ber,~] = calc_ber(tx_bits.signal,bits_rx.signal,"skip_front",0,"skip_end",0,"returnErrorLocation",1);
|
||||
disp(['BER: ',sprintf('%.1E',ber)]);
|
||||
assert(ber == 0)
|
||||
|
||||
else
|
||||
|
||||
if emulate_precode
|
||||
% emulate precode:
|
||||
% Entschiedene Symbole codieren: d_DB(n) = d(n) + d(n-1) (im Fall von PAM4 7 level [0 1 2 3 4 5 6])
|
||||
symbols_db = Duobinary().encode(tx_symbols); % das wäre der FFE mit db target
|
||||
|
||||
% Entschiedene codierte Symbole decodieren: d_dec(n) = d_DB(n) mod4
|
||||
rx_symbols = Duobinary().decode(symbols_db); % modulo
|
||||
bits_rx = PAMmapper(M,0).demap(rx_symbols); % demappen
|
||||
|
||||
% ref symbole precoden, auch hier muss man wieder etwas fummeln wegen der emulation:
|
||||
% encode + decode == remove precoding (mathematisch die gleiche operation)
|
||||
tx_symbols_ref = Duobinary().encode(tx_symbols);
|
||||
tx_symbols_ref = Duobinary().decode(tx_symbols_ref);
|
||||
tx_bits = PAMmapper(M,0).demap(tx_symbols_ref);
|
||||
|
||||
else
|
||||
% normal detection without any precode stuff
|
||||
symbols_db = Duobinary().encode(tx_symbols);
|
||||
|
||||
rx_symbols = tx_symbols;
|
||||
bits_rx = PAMmapper(M,0).demap(rx_symbols);
|
||||
end
|
||||
|
||||
|
||||
[~,~,ber,~] = calc_ber(tx_bits.signal,bits_rx.signal,"skip_front",1,"skip_end",1,"returnErrorLocation",1);
|
||||
disp(['BER: ',sprintf('%.1E',ber)]);
|
||||
assert(ber == 0)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user