Merge branch 'main' of cau-git.rz.uni-kiel.de:nt/mitarbeiter/silas/imdd_simulation

# Conflicts:
#	Classes/01_transmit/ChannelFreqResp.m
#	projects/400G_FTN_setups/imdd_mpi_dsp.m
This commit is contained in:
sioe
2024-11-04 09:09:57 +01:00
225 changed files with 30011 additions and 155 deletions

View File

@@ -27,7 +27,7 @@ classdef Signal
[~,obj.gitSHA] = system('git rev-parse HEAD');
[~,obj.gitStatus] = system('git status --porcelain');
[~,obj.gitPatch] = system('git diff');
% [~,obj.gitPatch] = system('git diff');
%%% Stuff for Logbook %%%
SignalType = [];
@@ -510,7 +510,7 @@ classdef Signal
end
%%
function [obj,S] = tsynch(obj,options)
function [obj,S,isFlipped] = tsynch(obj,options)
% time sync and cut
arguments
obj Signal
@@ -525,14 +525,16 @@ classdef Signal
q = obj.fs/options.fs_ref;
b = options.reference.resample("fs_in",options.fs_ref,"fs_out",obj.fs).normalize("mode","oneone").signal;
max_occurences = floor(length(a)/length(b));
%estimate delay between signals
[co,lags] = xcorr(a,b);
[~,pos] = max(co);
[~,pos] = max(abs(co));
D = lags(pos);
%estimate start pos of signal
maxpeaknum = floor(length(a)/length(b));
[pks,pkpos] = findpeaks(co./max(co),'MinPeakDistance',length(b)/2,'MinPeakHeight',0.2,'NPeaks',maxpeaknum);
[pks,pkpos] = findpeaks(abs(co./max(co)),'MinPeakDistance',length(b)/2,'MinPeakHeight',0.2,'NPeaks',maxpeaknum);
shifts = lags(pkpos);
%Cut occurences of ref signal from signal (only positive shifts)
@@ -543,9 +545,19 @@ classdef Signal
S{end+1,1} = sig;
end
%
isFlipped=0;
if all(sign(co(pkpos)))
isFlipped = 1;
end
%return/keep the sinal with the highest correlation (only within positive shifts)
[~,idx]=max(pks(shifts>0));
obj.signal = S{idx}.signal;
%put signal with highest corr. to first index in S array
swap = S{1};
S{1} = S{idx};
S{idx} = swap;
for c = 1:numel(shifts(shifts>0))
S{c}.logbook = [];