I am trying to calculate the minimum of a function with multiple variables, the only constraints I have are the upper and lower bounds of the variables. The problem I am having is that fmincon
does not change the input value from the initial guess value I give it.
This is the output I get:
initGuess = 0.6159
x = 0.6159
Initial point is a local minimum that satisfies the constraints.
Optimization completed because at the initial point, the objective function is non-decreasing in feasible directions to within the selected value of the function tolerance, and constraints are satisfied to within the selected value of the constraint tolerance.
<stopping criteria details>
This is my call to fmincon:
A = [];
b = [];
Aeq = [];
beq = [];
lb = 0;
ub = 1;
initGuess = 0.6159;
options = optimset('TolX',1e-12,'TolCon',1e-12,'TolFun',1e-12,'Algorithm','interior-point');
[optAM,optBC] = fmincon(@(x) cmpBC(x,epochDate,epochDate2,root,rvfm),[initGuess],A,b,Aeq,beq,lb,ub,nonlcon,options);
I tried multiple initial guesses and the same thing happens, please help not sure how fix this.
EDIT****
cmpBC:
function output = cmpBC(x,epochDate,epochDate2,root,rvfm)
cmdParamString = ['HPOP */Satellite/COMDEV_Sat Drag On 2.2 ' num2str(x(1)) ' "NRLMSISE 2000" File "C:\Program Files (x86)\AGI\STK 10\Data\sw20100101.txt"'];
root.ExecuteCommand(cmdParamString);
cmd = horzcat('Propagate */Satellite/COMDEV_Sat', ' "', epochDate, '" "', epochDate2,'"');
root.ExecuteCommand(cmd);
cmd = 'Report_RM */Satellite/COMDEV_Sat Style "J2000 Position Velocity"';
variableB = root.ExecuteCommand(cmd);
theSize = variableB.count;
posArray2=variableB.Item(theSize-2);
C = strread(posArray2,'%s','delimiter',',');
output = norm([str2num(C{2})-rvfm(1) str2num(C{3})-rvfm(2) str2num(C{4})-rvfm(3)]);
%rvfm is the known position of the satellite
end