Hessian only returns vector instead of matrix in fmincon
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
Dear All,
I am using the following code to get Hessian for a three parameter function. It should be a 3*3 matrix. But instead I get a 3*1 vector. Do you know why?
if true
  % 
x0=[10,10,10];
A = [-1 -2 -2; ...
    1  2  2];
b = [0;72];
options = optimoptions('fmincon','Algorithm','active-set','Hessian','on');
[xn,fval,exitflag,output,grad,hessian] = fmincon(@(x) -x(1) * x(2) * x(3),x0,A,b,[],[],[],[],[],options)
end
and the result get for Hessian is
hessian =
 -144.0002
 -288.0002
 -287.9994
댓글 수: 0
채택된 답변
  Alan Weiss
    
      
 2014년 12월 2일
         [x,fval,exitflag,output,lambda,grad,hessian] = fmincon(...)
In other words, what you call hessian is, in fact, the grad output. You forgot the lambda argument.
You should also take a look at the documentation of the fmincon Hessian to see what the output means.
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

