% Input:
% results: Matrix (evaluations of support functions)
% step: uint (sampling interval)
% epsilon: double(error tolerance)

% Output:
% fixpoint: int (index of the set at which a fixpoint has been detected)

% Description:
% Checks each "step"-evaluation for the existence of a fixpoint and returns
% the index of this set in the flowpipe or -1 in case of the non-existence
% of a fixpoint

% Beschreibung:
% Prüft alle step- Schritte, ob ein Fixpunkt (mit Toleranz epsilon)
% errechnet wurde. Wenn ja wird der index der Menge zurückgegeben, sonst -1

function [fixpoint] = checkFixpoint(results,step,epsilon)
tocheck = results(:,1:step:size(results,2));
temp= [zeros(size(results,1),1) tocheck(:,1:end-1)];
difference = tocheck-temp;
difference(:,1)=[];
fixpoint = find(sum(difference > -epsilon & difference < epsilon) == size(results,1),1);


