Skip to content
Snippets Groups Projects
Commit c529495b authored by leprob001's avatar leprob001
Browse files

Added function to calculate TOA data with a drift applied.

parent 27e966f6
No related branches found
No related tags found
No related merge requests found
function [drift] = calculateDrift(pStartRafosDate, pEndRafosDate, pStartOffset, pEndOffset)
%CALCULATEDRIFT Calculates the drift corresponding to 1 day.
% Calculates the drift of a soundsource in 1 day in seconds.
%
% Parameters:
% pStartRafosDate (double): The start rafos date that should be
% taken into account.
% pEndRafosDate (double): The end rafos date.
% pStartOffset (double): The starting offset [s].
% pEndOffset (double): The end offset [s].
%
% Returns:
% drift (double): The calculated drift [s/day].
%% Calculate drift
duration = pEndRafosDate - pStartRafosDate;
totalOffset = pEndOffset - pStartOffset;
drift = totalOffset / duration;
end
function [toa] = calculateToaAtTimestep(pToa, pTimestep, pStartOffset, pDrift)
%CALCULATETOAATTIMESTEP Calculates the TOA at the given timestep.
% Calculates the new TOA at the given timestep.
%
% Parameters:
% pToa (double): The start TOA.
% pTimestep (double): The timestep from start of the soundsource
% in rafos days.
% pStartOffset (double): The start offset of the soundsource.
% pDrift (double): The drift of the soundsource in seconds per day.
%% Calculate new toa
toa = pToa + pStartOffset + pDrift * pTimestep;
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment