Matlab . , . , x y, .
FMINCON, .
, , (, ), , , , x- xdata vectory y- ydata, " ". , , , . , , 5 ( ).
, 0. (.. y y). , .
function out = objFun(loc,xdata,ydata)
%
%
%
%
%
yhat = sum(bsxfun(@gt,xdata(:),loc(:)'),2); %'
%
out = sum((ydata(:)-yhat).^2);
objFun.m Matlab. xdata ydata ( ), loc ( k-by-1) Aeq , Aeq*loc==beq (Aeq [1 1 1], 3 )
locEst = fmincon(@(u)objFun(u,xdata,ydata),locInitialGuess,[],[],Aeq,5);
. , 5 - , , 5.