Hessian matrix using m-file

조회 수: 3 (최근 30일)
Matheus
Matheus 2017년 8월 18일
편집: John D'Errico 2017년 8월 18일
I would like to calculate a Hessian matrix of a function in the following way:
hessian('fob_8_52', [4 6])
fob_8_52.m is a file where I declared my function

답변 (1개)

John D'Errico
John D'Errico 2017년 8월 18일
편집: John D'Errico 2017년 8월 18일
If you just need to compute the hessian matrix of a general function (often called a black box: you pass stuff into the black box and stuff comes out, based on some unknown algorithm.)
As long as your function is reasonably well behaved, you can use my derivest toolbox, found on the file exchange .
I'll show it here, using a function handle.
rosen = @(x) (1-x(1)).^2 + 105*(x(2)-x(1).^2).^2;
Hmat = hessian(rosen,[2 3])
Hmat =
3782 -840
-840 210
If you have an m-file, just do this:
hessian(@fob_8_52, [4 6])
  댓글 수: 2
Matheus
Matheus 2017년 8월 18일
I tried use this, but this message appears "Undefined function 'hessian' for input arguments of type 'function_handle'"
John D'Errico
John D'Errico 2017년 8월 18일
편집: John D'Errico 2017년 8월 18일
Did you bother to download the toolbox from the file exchange and then put it on your search path? It won't appear as if by magic.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by