Files
imdd_silas/Classes/04_DSP/Timing Recovery/Timing_Recovery_Move_It.m
magf 005e821131 Added:
- Class folder 'Timing Recovery' with different timing recoveries
- Minimal example for the timing recovery on the FSO data
- New evaluation scripts in the FSO project folder
2026-02-02 10:56:12 +01:00

78 lines
2.4 KiB
Matlab

classdef Timing_Recovery_Move_It < handle
properties(Access=public)
f_sim
gamma
end
methods(Access=public)
function obj = Timing_Recovery_Move_It(options)
arguments(Input)
options.f_sim = 14e9;
options.gamma = 0.1;
end
fn = fieldnames(options);
for n = 1:numel(fn)
obj.(fn{n}) = options.(fn{n});
end
%obj-Initialization here%
end
function data_out = process(obj, data_in)
e = NaN(size(data_in.signal));
T = 1/obj.f_sim;
t = zeros(size(data_in.signal));
t(2) = T/2;
mu = zeros(size(data_in.signal));
% n = 2;
for k = 3:2:length(data_in.signal)
data_in.signal(k-1) = data_in.signal(k-1)*(1-mu(k-2)) + data_in.signal(k)*mu(k-2);
data_in.signal(k) = data_in.signal(k)*(1-mu(k-1)) + data_in.signal(k+1)*mu(k-1);
% TED
e(k) = (data_in.signal(k-2)-data_in.signal(k))*data_in.signal(k-1);
e(k+1) = e(k);
% TED Mueller Mueller
% e(k) = ref_in(n-1)*data_in.signal(k) - ref_in(n)*data_in.signal(k-2);
% e(k+1) = e(k);
% n = n+1;
%
% interpolator control
% t(k) = t(k-1) + T/2 + obj.gamma/2*e(k);
% t(k+1) = t(k) + T/2 + obj.gamma/2*e(k+1);
t(k) = t(k-1) + T/2 + obj.gamma*e(k)*T/2;
t(k+1) = t(k) + T/2 + obj.gamma*e(k+1)*T/2;
% t(k) = k*T/2 + obj.gamma*e(k)*T/2;
% t(k+1) = k*T/2 + obj.gamma*e(k+1)*T/2;
% interpolator
mu(k) = t(k)/(T/2) - round(t(k)/(T/2));
mu(k+1) = t(k+1)/(T/2) - round(t(k+1)/(T/2));
thres = 0.7;
if mu(k)-mu(k-1) > thres
mu(k) = mu(k) - 1;
elseif mu(k) - mu(k-1) < -thres
mu(k) = mu(k) + 1;
end
if mu(k+1)-mu(k) > thres
mu(k+1) = mu(k+1) - 1;
elseif mu(k+1) - mu(k) < -thres
mu(k+1) = mu(k+1) + 1;
end
end
data_out = data_in;
end
end
end