You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: MCCE.m
    path of file: ./repos/HydroSight/algorithms/calibration/SP_UCI
    
    the code of the file until where you have to start completion: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%function [S,Sf,icall,stochDerivedForcingData]=MCCE(funcHandle,funcHangle_validParams,s,sf,bl,bu,icall, useDerivedForcing, stochDerivedForcingData, varargin)
function [S,Sf,icall]=MCCE(funcHandle,funcHangle_validParams,s,sf,bl,bu,icall, varargin)
% This is the subroutine implementing the simplex algorithm

% Definition of input/output variables
%  s/S = simplex members(vertices)in order of increasing function values
%  sf/Sf = objective functions at simplex vertices


nps = size(s,1);
n = nps;
alpha = 1.0; % reflection coefficient.
beta = 0.5;% contraction coefficient.

% Assign the best and worst points:
sb=s(1,:); fb=sf(1);
sN=s(n-1,:); fN=sf(n-1);
sw=s(n,:); fw=sf(n);

% Compute the centr
    
function [S,Sf,icall,stochDerivedForcingData]=MCCE(funcHandle,funcHangle_validParams,s,sf,bl,bu,icall, useDerivedForcing, stochDerivedForcingData, varargin)
function [S,Sf,icall]=MCCE(funcHandle,funcHangle_validParams,s,sf,bl,bu,icall, varargin)
% This is the subroutine implementing the simplex algorithm

% Definition of input/output variables
%  s/S = simplex members(vertices)in order of increasing function values
%  sf/Sf = objective functions at simplex vertices


nps = size(s,1);
n = nps;
alpha = 1.0; % reflection coefficient.
beta = 0.5;% contraction coefficient.

% Assign the best and worst points:
sb=s(1,:); fb=sf(1);
sN=s(n-1,:); fN=sf(n-1);
sw=s(n,:); fw=sf(n);

% Compute the centroid of the simplex excluding the worst point:
ce=mean(s(1:n-1,:));

% Attempt a reflection point
snew = ce + alpha*(ce-sw);

% If the reflection point is outside bound, reflect it back into the feasible
% space
snew(snew>bu)=2*bu(snew>bu)-snew(snew>bu) ;
snew(snew<bl)=2*bl(snew<bl)-snew(snew<bl);
snew(snew>bu)=bu(snew>bu);
snew(snew<bl)=bl(snew<bl);

% Check if the point is valid
isValid = feval(funcHangle_validParams,snew', varargin{:});
isValid = all(isValid);
doneFeval=false;
if isValid
    %if useDerivedForcing
    %    updateStochForcingData(varargin{1},[]);            
    %end