try to find hessian matrix
28 次查看(过去 30 天)
显示 更早的评论
f(k) = n*ln(k)-n*ln(1/n*sum(i=1 to n)xi^k+(k-1)sum of (1to n)ln(xi))-n
3 个评论
Dyuman Joshi
2023-7-13
The expression you have written above is not clear. Please format it properly.
采纳的回答
Rahul
2023-7-13
Hi Taniya,
Assuming you have k, n and xi, you can try the following code to find the Hessian Matrix:
f = n*log(k) - n*log(1/n * sum(xi^k, i, 1, n) + (k-1) * sum(log(xi), i, 1, n)) - n;
% Calculate the second partial derivatives
d2f_dk2 = diff(f, k, 2);
d2f_dxi_dk = diff(f, k, xi);
d2f_dk_dxi = diff(f, xi, k);
d2f_dxi2 = diff(f, xi, 2);
% Create the Hessian matrix
H = [d2f_dk2, d2f_dxi_dk; d2f_dk_dxi, d2f_dxi2];
Hope this helps.
Thanks.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!