% This function is part of the NMSM Pipeline, see file for full license.
%
% This function computes the sum of the squared error for all the markers
% in the argument InverseKinematicsSolver's current frame. The frame can be
% set by initialization an InverseKinematicsSolver, initializing the Model
% system, assembling the InverseKinematicsSolver for a given time.
%
% (InverseKinematicsSolver) -> (number)
% iterate through markers and sum the error
function error = calculateFrameSquaredError(ikSolver)
error = zeros(1, ikSolver.getNumMarkersInUse());
for i=0:ikSolver.getNumMarkersInUse()-1
error(i+1) = ikSolver.computeCurrentMarkerError(i);
end
error = error / sqrt(length(error));
end