ecoc measurements

This commit is contained in:
Silas Labor Zizou
2025-04-13 16:29:12 +02:00
parent 00f1c557c0
commit 0236103b13
19 changed files with 709 additions and 359 deletions

View File

@@ -6,10 +6,8 @@ classdef Pulseformer
end
properties(Access=public)
fs
fdac
fsym
matched_sps
output_sps
pulse
pulselength
alpha
@@ -22,10 +20,8 @@ classdef Pulseformer
% Detailed explanation goes here
arguments
options.fs double
options.fdac double
options.fsym double
options.matched_sps double
options.output_sps double
options.pulse pulseform = pulseform.rc
options.pulselength double {mustBeInteger} = 32
options.alpha double = 0.05
@@ -54,11 +50,7 @@ classdef Pulseformer
signalclass_in = signalclass_in.logbookentry(lbdesc);
% write fs to signal
if obj.matched
signalclass_in.fs = obj.fsym .* obj.output_sps;%.* (obj.fdac./obj.fsym);
else
signalclass_in.fs = obj.fs;%.* (obj.fdac./obj.fsym);
end
signalclass_in.fs = obj.fdac;%.* (obj.fdac./obj.fsym);
% write to output
signalclass_out = signalclass_in;
@@ -85,19 +77,15 @@ classdef Pulseformer
data_out
end
if ~isempty(obj.output_sps)
obj.fsym = obj.fsym.*obj.output_sps;
end
if ~rem(obj.fs,obj.fsym)
if ~rem(obj.fdac,obj.fsym)
%ist ein Vielfaches
sps = obj.fs / obj.fsym;
sps = obj.fdac / obj.fsym;
p = sps;
q = 1;
else
%ist kein Vielfaches
p = obj.fsym / gcd(obj.fs, obj.fsym); %upsampling p->->->
q = obj.fs/ gcd(obj.fs, obj.fsym); %downsampling <-q
p = obj.fsym / gcd(obj.fdac, obj.fsym); %upsampling p->->->
q = obj.fdac/ gcd(obj.fdac, obj.fsym); %downsampling <-q
sps= q; %sps während dem pulse shaping
end
@@ -117,7 +105,6 @@ classdef Pulseformer
end
manual_cyclic_convolution = 0;
upsample_filter = 0;
upfirdn_convolution = 1;
if manual_cyclic_convolution
@@ -135,28 +122,16 @@ classdef Pulseformer
data_out=ifft( fft(symbolov.') .* repmat( H,size(data_in,1),1 ).' ).';
data_out = circshift(data_out,[0 -(obj.pulselength*sps)]);
if rem(obj.fs,obj.fsym)
if rem(obj.fdac,obj.fsym)
data_out = data_out(1:q:end);
end
end
if upsample_filter
data_out_ = upsample(data_in,p);
mfOutput = filter(h, 1, data_out_); % Matched filter output
figure()
hold on
stem(mfOutput(1:1000),'Marker','o','MarkerSize',1,'LineStyle','-','LineWidth',1);
stem(data_out_(1:1000),'Marker','o','MarkerSize',1,'LineStyle','-','LineWidth',1);
end
if upfirdn_convolution
%Apply Filter using Matlab build in fctn.
data_out_ = upfirdn(data_in,h,p,q);
%cut signal, which is longer due to fir filter
@@ -183,7 +158,7 @@ classdef Pulseformer
% scale = max(max([abs(real(data_out)) abs(imag(data_out))])); %find max value from real and imag part
% data_out = data_out./scale;
data_out = data_out';
% data_out = data_out';
%Check output integrity
if abs(round(p/q * length(data_in)) - length(data_out)) > 4