own EQ implemented and returns same performance like Toms
This commit is contained in:
@@ -102,10 +102,10 @@ classdef EQ
|
||||
|
||||
end
|
||||
|
||||
function signalclass_out = process(obj,signalclass_in, reference_signalclass_in)
|
||||
function [signalclass_out,error_log] = process(obj,signalclass_in, reference_signalclass_in)
|
||||
|
||||
% actual processing of the signal (steps 1. - 3.)
|
||||
signalclass_in.signal = obj.process_(signalclass_in.signal', reference_signalclass_in.signal');
|
||||
[signalclass_in.signal,error_log] = obj.process_(signalclass_in.signal', reference_signalclass_in.signal');
|
||||
|
||||
signalclass_in.signal = signalclass_in.signal';
|
||||
% append to logbook
|
||||
@@ -117,7 +117,7 @@ classdef EQ
|
||||
|
||||
end
|
||||
|
||||
function yout = process_(obj,data_in,ref_in)
|
||||
function [yout,error_log] = process_(obj,data_in,ref_in)
|
||||
%METHOD1 Summary of this method goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
@@ -211,43 +211,62 @@ classdef EQ
|
||||
epsilon_ = diag([ones(1,obj.Ne(1))*obj.epsilon(1) ones(1,N2)*obj.epsilon(2) ones(1,N3)*obj.epsilon(3)]);
|
||||
end
|
||||
|
||||
obj.k0 = obj.delay; % input delay compared to training sequence<
|
||||
|
||||
obj.k0 = obj.delay; % input delay compared to training sequence
|
||||
error_log = [];
|
||||
|
||||
if 1 % obj.active
|
||||
%% Calculation of the filter coefficients in training based LMS mode
|
||||
|
||||
e_ = zeros(obj.Ne(1)+N2+N3,1); % initialization of filter coefficients
|
||||
% e(ceil(obj.Ne(1)/2)) = 1; % set central tap to 1 (better starting point since it's closer to the expected solution)
|
||||
|
||||
b_ = zeros(obj.Nb(1)+Nb2+Nb3,1);
|
||||
|
||||
e_dc = mean(data_in); % initilaization of the dc tap with the mean value of the data
|
||||
% e_save = NaN(361,8.6e5);
|
||||
% save_ind = 1;
|
||||
e_dc = mean(data_in); % initilaization of the dc tap with the mean value of the whole data
|
||||
|
||||
for trainloops = 1:obj.training_loops
|
||||
cnt = 1;
|
||||
m = obj.k0+1; % starting symbol index at the delay compared to the training sequence
|
||||
|
||||
error_log = [];
|
||||
for n = obj.K*obj.k0+1:obj.K:obj.K*obj.training_length
|
||||
m = m+1;
|
||||
X_1 = data(obj.Ne(1)+n+(obj.K-1):-1:n+obj.K).';
|
||||
|
||||
|
||||
% X_1(X_1~=0) = X_1(X_1~=0) - mean(X_1(X_1~=0));
|
||||
% 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).';
|
||||
|
||||
[X_2,X_3] = obj.calc_nl_vecs(X_1,ind_mat_2nd,ind_mat_3rd,norm_fac2,norm_fac3,delta_2,delta_3,cplx);
|
||||
|
||||
input_vec = [X_1;X_2;X_3];
|
||||
|
||||
% cut symbols from desired data sequence (correct symbols in training mode)
|
||||
D_1 = ref(obj.Nb(1)-obj.k0+m-2:-1:m-obj.k0-1).';
|
||||
|
||||
[D_2,D_3] = obj.calc_nl_vecs(D_1,ind_mat_DFE_2nd,ind_mat_DFE_3rd,norm_fac_DFE2,norm_fac_DFE3,delta_DFE2,delta_DFE3,cplx);
|
||||
|
||||
input_vec = [X_1;X_2;X_3];
|
||||
reference_vec = [D_1;D_2;D_3];
|
||||
error = e_dc + e_.'*input_vec - b_.'*reference_vec - ref_in(m-obj.k0); % error = e_dc + e.'*input_vec - b.'*reference_vec - ref_in(m-obj.k0);
|
||||
|
||||
e_ffe = e_.'*input_vec;
|
||||
e_dfe = b_.'*reference_vec;
|
||||
|
||||
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_;
|
||||
sgn_e(e_~=0) = e_(e_~=0)./abs(e_(e_~=0));
|
||||
e_ = e_ - obj.rho*sgn_e./(1+epsilon_*abs(e_)) - error*input_vec*obj.FFEmu;
|
||||
else
|
||||
e_ = e_ - error*conj(input_vec)*obj.FFEmu; %e = e - error*conj(input_vec)*obj.FFEmu; %e = e - error*input_vec*obj.FFEmu;
|
||||
e_ = e_ - error*conj(input_vec)*obj.FFEmu; %classic LMS gradient decay
|
||||
end
|
||||
else
|
||||
if obj.l1act
|
||||
@@ -258,21 +277,24 @@ classdef EQ
|
||||
e_ = e_ - error*input_vec/(input_vec.'*input_vec);
|
||||
end
|
||||
end
|
||||
% e_save(:,save_ind) = e;
|
||||
% save_ind = save_ind+1;
|
||||
e_dc = e_dc - obj.DCmu*error;
|
||||
error_log(end+1) = e_dc;
|
||||
|
||||
e_dc = e_dc - obj.DCmu*error;
|
||||
error_log(cnt,trainloops) = e_dc;
|
||||
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
|
||||
|
||||
|
||||
@@ -355,6 +377,7 @@ classdef EQ
|
||||
end
|
||||
|
||||
for dd_loop = 1:obj.dd_loops
|
||||
cnt = obj.training_length+1;
|
||||
m = 0;
|
||||
output_vec = zeros(1,floor(length(data_in)/obj.K)); % initilaization of the output vector
|
||||
dd_DFE = zeros(obj.Nb(1),1);
|
||||
@@ -384,9 +407,8 @@ classdef EQ
|
||||
|
||||
for k = 1:obj.K:length(data_in)
|
||||
m=m+1; % Symbol index
|
||||
X_1 = data(obj.Ne(1)+k-1:-1:k).';
|
||||
|
||||
|
||||
X_1 = data(obj.Ne(1)+k-1:-1:k).';
|
||||
|
||||
[X_2,X_3] = obj.calc_nl_vecs(X_1,ind_mat_2nd,ind_mat_3rd,norm_fac2,norm_fac3,delta_2,delta_3,cplx);
|
||||
|
||||
@@ -403,6 +425,7 @@ classdef EQ
|
||||
dd_out(k) = constellation_in_(dd_idx);
|
||||
end
|
||||
|
||||
|
||||
if obj.Nb(1) > 0
|
||||
dd_DFE(2:end) = dd_DFE(1:end-1);
|
||||
dd_DFE(1) = dd_out(k);
|
||||
@@ -423,14 +446,15 @@ classdef EQ
|
||||
% save_ind = save_ind+1;
|
||||
|
||||
if mu_mat ~= 0
|
||||
e_dc = e_dc - obj.DCmu*error;
|
||||
error_log(end+1) = e_dc;
|
||||
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))).';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user