Skip to content
Snippets Groups Projects
solve.m 1.38 KiB
Newer Older
function [A, B, X, unfilteredA] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pAppliedTemperature, pAppliedPressure, pLeapsecondsMatrix, pOffsetsParameter)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here

%% Construct matrices A and B
[unfilteredA, B] = artoa.offsets.createCalculationTables( ...
    pSoundsources, ...
    pTrackingParameter, ...
    pToaData, ...
    pSatData, ...
    pAppliedTemperature, ...
    pAppliedPressure, ...
    pLeapsecondsMatrix ...
);

%% Subtract all known offsets
[B] = artoa.offsets.subtractKnownOffsets( ...
    unfilteredA, ...
    B, ...
    pOffsetsParameter.offsets ...
);

%% Subtract all known drifts
[B] = artoa.offsets.subtractKnownDrifts( ...
    unfilteredA, ...
    B, ...
    pOffsetsParameter.offsets ...
);

%% Optimize matrices for calculation
[A] = artoa.offsets.filterCalculationTables( ...
    unfilteredA, ...
    pOffsetsParameter.offsets ...
    );
%% Use fixed soundspeed
    if isempty(A)
        return; % nothing to be done, everything is given and soundspeed is fixed
    end
    
    B.toa = B.toa - A{:, 'Distances'} * pOffsetsParameter.fixedSoundspeed;
    A.Distances = [];
X = pinv(A{:, :}) * B.toa;
%% Apply row names to X
X = table(X, 'VariableNames', {'Value'}, 'RowNames', A.Properties.VariableNames);