function y = custand(x)
%CUSTAND Customized AND function for CUSTTIP.FIS.

% Copyright 1996 - 2018 The MathWorks, Inc.

% Lukasiewicz t-norm: T(a,b) = max(0, a+b-1)

minVal = zeros(1,size(x,2),'like',x);
y = ones(1,size(x,2),'like',x);

for i = 1:size(x,1)
    y = max(minVal,sum([y;x(i,:)])-1);
end
end