Problem using Hessian function
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi ,
I am trying to calculate the hessian of the following function :
---------------
function logl = tryseven(p, xdata, ydata)
a = p(1);
b = p(2);
f = p(3);
g = p(4);
h = size(xdata,2)*log(a);
i = size(xdata,2)*log(b);
j = (b-1)*(log(ydata - f - g*xdata));
k = a*((ydata - f - g*xdata).^b);
logl = [-sum(j(:)) + sum(k(:) -h -i)];
end
--------------------
I run the following command , by providing the point at which Hessian has to be calculated:
--------------------
p(1) = 0.5272;
p(2) = 1.2401;
p(3) = -0.5815;
p(4) = 14.2491;
[hess,err]=hessian(@(p) tryseven(p, xdata, ydata))
-----------------------
But I am getting an error "Not enough input arguments."
Can somebody please tell me what error I have committed? I have attached my data.
Regards,
Prachi
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 7월 7일
Are you trying to use Symbolic Toolbox hessian() ? If so then it requires a symbolic function or symbolic expression first argument, an requires a vector of symbolic names as a second argument.
If you are trying to use This File Exchange Contribution then a scalar function first argument is fine, but the second argument needs to be the location to evaluate the Hessian at.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!