Skip to main content

calcMagnitudeDeviations.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the magnitude difference between two curves. The
% purpose of this is to be used in a cost function that incentivises the
% optimized curve to closely match the original curve.
%
% (3D array of number, 3D array of number) -> (2D array of number)
% Calculates magnitude deviation across trials (dimension 1)


function magnitudeDeviations = calcMagnitudeDeviations(optimizedCurves, ...
originalCurves)

meanOptimizedCurves = mean(optimizedCurves, 1);
meanOriginalCurves = mean(originalCurves, 1);

magnitudeDeviations = meanOptimizedCurves - meanOriginalCurves;
end