+++ Changes +++
+ duobinary_target now supports memoryless decoding (FFE targets DB response without MLSE) + PAMmapper.quantize now supports custom constellations for quantization + Added a new folder 'Documentations' for pdfs, slides, etc. + Added new FSO evaluation scripts in projects/FSO transmission/Evaluation Scripts + Added ffe_db (rudimentary module, not important anymore)
This commit is contained in:
82
Classes/03_electrical/CTLE.m
Normal file
82
Classes/03_electrical/CTLE.m
Normal file
@@ -0,0 +1,82 @@
|
||||
classdef CTLE < handle
|
||||
|
||||
properties(Access=public)
|
||||
Aac_dB
|
||||
Adc_dB
|
||||
f_p1
|
||||
f_p2
|
||||
plot
|
||||
end
|
||||
|
||||
methods(Access=public)
|
||||
function obj = CTLE(options)
|
||||
arguments
|
||||
options.Aac_dB = 0;
|
||||
options.Adc_dB = -6;
|
||||
options.f_p1 = 1.5e9;
|
||||
options.f_p2 = 5e9;
|
||||
options.plot = 0;
|
||||
end
|
||||
|
||||
fn = fieldnames(options);
|
||||
for n = 1:numel(fn)
|
||||
obj.(fn{n}) = options.(fn{n});
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function data_out = process(obj, data_in)
|
||||
|
||||
x = data_in.signal(:);
|
||||
Fs = data_in.fs;
|
||||
N = length(x);
|
||||
|
||||
% CTLE Transfer Function Parameters
|
||||
A_ac = 10^(obj.Aac_dB/20);
|
||||
A_dc = 10^(obj.Adc_dB/20);
|
||||
w1 = 2*pi*obj.f_p1;
|
||||
w2 = 2*pi*obj.f_p2;
|
||||
|
||||
% Frequency Domain Conversion
|
||||
X = fft(x);
|
||||
|
||||
% Generating Frequency Axis In The Range Of [-Fs/2,Fs/2]
|
||||
f_fft = (0:N-1).' * (Fs/N);
|
||||
f_signed = f_fft;
|
||||
idxNeg = f_signed > Fs/2;
|
||||
f_signed(idxNeg) = f_signed(idxNeg) - Fs;
|
||||
f_pos = abs(f_signed);
|
||||
w_pos = 2*pi*f_pos;
|
||||
s_pos = 1j*w_pos;
|
||||
|
||||
% Calculate CTLE Transfer Function
|
||||
H_pos = A_ac*w2 .* (s_pos + (A_dc/A_ac)*w1) ./ ((s_pos + w1).*(s_pos + w2));
|
||||
|
||||
% Enforce H(-f) = conj(H(f)) For Negative Bins
|
||||
H = H_pos;
|
||||
H(idxNeg) = conj(H_pos(idxNeg));
|
||||
|
||||
% Apply CTLE
|
||||
Y = H .* X;
|
||||
|
||||
% Calculate Time Domain Signal
|
||||
y = ifft(Y, 'symmetric');
|
||||
data_out = data_in;
|
||||
data_out.signal = y;
|
||||
data_out.fs = Fs;
|
||||
|
||||
% Plot
|
||||
if obj.plot
|
||||
% plot only positive frequencies up to Fs/2
|
||||
k = 1:floor(N/2)+1;
|
||||
fplot = f_fft(k);
|
||||
Hplot = H(k);
|
||||
|
||||
figure;
|
||||
semilogx(fplot, 20*log10(abs(Hplot)+1e-15));
|
||||
grid on; xlabel('frequency (Hz)'); ylabel('magnitude (dB)');
|
||||
title('CTLE magnitude on FFT grid');
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user