Minor Changes here and there

This commit is contained in:
Silas Oettinghaus
2024-08-16 10:08:50 +02:00
parent 3f089dca9f
commit 793a5b7efd
7 changed files with 100 additions and 68 deletions

View File

@@ -7,7 +7,7 @@ classdef Photodiode
responsivity
dark_current
temperature
nep
randomkey
randomstream
@@ -22,6 +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.randomkey = 1;
end
@@ -71,11 +72,16 @@ classdef Photodiode
yout = yout + shot_noise;
% Thermal Noise
therm_current_psd = (2 * k * T / R ) ; %squared
therm_current_psd = 1.8e-11^2;
% NEP is noise equivalent power, see Dissertation j. Leibrich
% P. 121 or Stephan Pachnicke Optical Comm. Lecture Slides
if obj.nep == 0
nep_squared = (2 * k * T / R ) ; %squared
else
nep_squared = obj.nep^2;
end
Bw = obj.fsimu;
therm_noise_pow = therm_current_psd * Bw; %squared
therm_noise_pow = nep_squared * Bw; %squared
therm_noise = sqrt(therm_noise_pow) .* randn(obj.randomstream,size(yout,1),1);

View File

@@ -140,6 +140,8 @@ classdef FFE < handle
err(symbol) = y(symbol) - d_hat(symbol); % Instantaneous error
true_err(symbol) = y(symbol) - d(symbol); % Instantaneous error
if mio ~= 0
obj.e = obj.e - (mio * err(symbol) * U) ; % Weight update rule of LMS
else

View File

@@ -101,7 +101,7 @@ classdef FFE_DCremoval < handle
err = 0;
% e_dc_buffer = NaN(100,1);
e_dc_buffer = NaN(10,1);
e_dc_buffer = NaN(1,1);
e_dc_est = 0;
for epoch = 1 : epochs

View File

@@ -124,12 +124,15 @@ classdef FFE_FFDCAVG < handle
ylim([-1 1])
drawnow
end
for epoch = 1 : epochs
symbol = 0;
err_buffer = zeros(numel(obj.constellation),50);
err_buffer = zeros(numel(obj.constellation),90);
dc_err = zeros(numel(obj.constellation),1);
dc_sto = NaN(numel(obj.constellation),N);
for sample = 1 : obj.sps : N
symbol = symbol+1;
@@ -142,16 +145,29 @@ classdef FFE_FFDCAVG < handle
[~,symbol_idx] = min(abs(d(symbol) - obj.constellation)); % decision for closest constellation point
d_hat(symbol,1) = d(symbol);
else
[~,symbol_idx] = min(abs(y(symbol) - obj.constellation)); % decision for closest constellation point
always_correct_decision = 0;
if always_correct_decision
[~,symbol_idx] = min(abs(d(symbol) - obj.constellation)); % decision for closest constellation point
else
[~,symbol_idx] = min(abs(y(symbol) - obj.constellation)); % decision for closest constellation point
end
d_hat(symbol,1) = obj.constellation(symbol_idx);
end
err(symbol) = y(symbol) - d_hat(symbol); % Instantaneous error
err_buffer(symbol_idx,1) = err(symbol);
err_buffer(symbol_idx,:) = circshift(err_buffer(symbol_idx,:),1);
y(symbol) = y(symbol) - obj.mu_buff*mean(err_buffer(symbol_idx,:));
if 1
%use buffer for dc-error
err_buffer(symbol_idx,1) = err(symbol);
err_buffer(symbol_idx,:) = circshift(err_buffer(symbol_idx,:),1);
dc_sto(symbol_idx,symbol) = obj.mu_buff*mean(err_buffer(symbol_idx,:));
y(symbol) = y(symbol) - obj.mu_buff * mean(err_buffer(symbol_idx,:));
else
%or use 1+alpha*D as adaptive error
dc_err(symbol_idx) = dc_err(symbol_idx) + obj.mu_buff * err(symbol);
dc_sto(symbol_idx,symbol) = dc_err(symbol_idx);
y(symbol) = y(symbol) - dc_err(symbol_idx);
end
if training
[~,symbol_idx] = min(abs(d(symbol) - obj.constellation)); % decision for closest constellation point
@@ -173,8 +189,10 @@ classdef FFE_FFDCAVG < handle
if mod(sample,100) == 1 && showviz
a2.XData = 1:2*numel(y);
a2.YData = repelem(y, 2);
a3.XData = 1:2*numel(d_hat);
a3.YData = repelem(d_hat, 2);
a4.Value = sample;
% b.YData = x(symbol:symbol+500);
c.YData = obj.e;