function eventFcn = constructEventOutputPeak(m)
% function eventFcn = constructEventOutputPeak(m)
% 
% This function constructs an events function that looks for local maxima
% of the model output.  It stops integration when it finds one.

eventFcn = @events;

    function [val isTerm direction] = events(t, x, u)
        val       = m.c*m.f(t, x, u);
        isTerm    = 1;
        direction = -1;
    end
end