Bald fertig für richtige Nutzung - Move_it vergleich fertig

Complete Checkup with Move_it: this framework is an almost perfect reproduction.
This commit is contained in:
Silas Oettinghaus
2023-06-08 15:33:57 +02:00
parent 2868887a15
commit 2aeacafe78
14 changed files with 198 additions and 122 deletions

View File

@@ -106,8 +106,13 @@ classdef Signal
end
%% Add signals from one signal to another, the first object will sustain
function Sum = plus(X,Y)
Sum = X; %first input object will sustain
Sum.signal = X.signal + Y.signal;
end
%% Display length
%% Display length
function return_length = length(obj)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
@@ -135,7 +140,7 @@ classdef Signal
end
%% Resample Signal
%% Resample Signal
function obj = resample(obj,options)
arguments
@@ -203,7 +208,7 @@ classdef Signal
psd = psd/length(Fsignal);
%smoothing
psd = smooth(psd,50);
psd = smooth(psd,1000);
psd_plot = 20*log10(psd);
@@ -255,6 +260,57 @@ classdef Signal
end
%%
function obj = normalize(obj,options)
arguments
obj Signal
options.mode normalization_mode = normalization_mode.rms
end
switch options.mode
case normalization_mode.rms
obj.signal = obj.signal/sqrt(mean(abs(obj.signal).^2,"all"));
case normalization_mode.oneone
obj.signal = obj.signal/max(abs(obj.signal));
end
end
%%
function obj = delay(obj,options)
arguments
obj Opticalsignal
options.delay_meter double = 0
end
delay_t = options.delay_meter /(physconst("LightSpeed")/1.4677);
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;
% finally circshift the signal
obj.signal=circshift(obj.signal,delay_n);
end
end
end