version where the signal is flipped and added together

This commit is contained in:
Silas Oettinghaus
2023-07-10 15:08:25 +02:00
parent 93dd63bb18
commit 3c11e4b2e5
10 changed files with 778 additions and 421 deletions

View File

@@ -280,7 +280,7 @@ classdef Signal
end
%%
function obj = delay(obj,options)
function [obj,delay_n] = delay(obj,options)
arguments
obj Opticalsignal
@@ -291,27 +291,29 @@ classdef Signal
delay_n = round(delay_t .* obj.fs);
% build "long" hann window to fade the signal in and out
% -> prevent hard step in the signal!
hann_wind = hann(200);
ones_wind = ones(size(obj.signal));
ones_wind(1:100) = hann_wind(1:100);
ones_wind(end-100:end) = hann_wind(end-100:end);
% subtract average
mu = mean(obj.signal,"all");
obj.signal = obj.signal - mu;
%apply hann
obj.signal = obj.signal .* ones_wind;
%add average again
obj.signal = obj.signal + mu;
% % build "long" hann window to fade the signal in and out
% % -> prevent hard step in the signal!
% hann_wind = hann(200);
% ones_wind = ones(size(obj.signal));
% ones_wind(1:100) = hann_wind(1:100);
% ones_wind(end-100:end) = hann_wind(end-100:end);
%
% % subtract average
% mu = mean(obj.signal,"all");
%
% obj.signal = obj.signal - mu;
%
% %apply hann
% obj.signal = obj.signal .* ones_wind;
%
% %add average again
% obj.signal = obj.signal + mu;
% finally circshift the signal
obj.signal=circshift(obj.signal,delay_n);
% obj.signal=[obj.signal(delay_n:end); zeros(delay_n-1,1)];
end
end
end