function varargout = evalmf(varargin)
%% EVALMF Evaluates membership functions.
%
%   Y = EVALMF(MF,X) Evaluates a type-1 MF with X to generate Y. MF is a
%   scalar or vector of membership function objects and X contains numeric
%   values to be evaluated by MF. 
%
%   If MF
%     - is a scalar, X can be a scalar, vector, or 2D matrix.
%     - is a vector, X must be a scalar or vector.
%
%   If MF is a scalar membership function object, the size of Y is same as
%   X. In case of a linear membership function, size of Y depends on number
%   of input sets specified in X.
%
%   If MF is a vector, Y is a matrix of size [M N], where M and N are
%   lengths of MF and X, respectively.
%
%   [YU,YL] = EVALMF(MF,X) Evaluates a type-2 MF with input values X to
%   generate output values YU and YL, where YU represents the evaluated
%   outputs of the upper membership functions of MF and YL corresponds to
%   the evaluated outputs of the lower membership functions.
%
%   Examples
%     %% Type-1 membership functions.
%     mf = [fismf(@gaussmf,[1.5 5]) fismf(@trapmf,[3 4 6 7])];
%     x = (-2:0.1:12)';
%     y = evalmf(mf,x);
%     plot(x,y)
%     xlabel('Universe of discourse (x)'),ylabel('Type-1 membership value (y)')
%     legend('gaussmf, P=[1.5 5]','trapmf, P=[3 4 6 7]')
%
%     %% Type-2 membership functions.
%     mf = [fismftype2(@gaussmf,[1.5 5]) fismftype2(@trapmf,[3 4 6 7])];
%     x = (-2:0.1:12)';
%     [yu,yl] = evalmf(mf,x);
%     plot(x,[yu;yl])
%     xlabel('Universe of discourse (x)'),ylabel('Type-2 Membership values (yu,yl)')
%     legend('gaussmf, P=[1.5 5]','trapmf, P=[3 4 6 7]')
%
%   See also
%     fismf fismftype2

%   Copyright 1994-2019 The MathWorks, Inc.

narginchk(2,3)

if nargin==3
    warning(message('fuzzy:general:warnDeprecation_Evalmf'))
    varargout{1} = fuzzy.internal.utility.evalmf(varargin{:});
else
    [varargout{1:nargout}] = getMembershipValue(varargin{:});
end

end