DistanceMaximum.m 774 Bytes
%Class computing the maximum point of a model variable curve. It extends
%the abstract class EvaluationFunction. The method compute_evalfunc takes in input
%an object TimeBehavior and returns in output the maximum point. 

classdef DistanceMaximum < EvaluationFunction    
    
    properties
    end
   
    methods
       
        function EvalFuncValue=compute_ef(obj,obj_TimeBehavior)
            [maximum1, timeOfMaximum1]=max(obj_TimeBehavior.values(:,0:100),[],2)
            [maximum2, timeOfMaximum2]=max(obj_TimeBehavior.values(:,101:end),[],2)
            %distance=obj_TimeBehavior.time(timeOfMaximum2) - obj_TimeBehavior.time(timeOfMaximum1)
            distance=abs(maximum2 - maximum1);
            EvalFuncValue=distance
        end
        
    end
    
end