MATLAB FINANCIAL DERIVATIVES TOOLBOX Instrukcja Użytkownika Strona 112

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 119
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 111
111
Call a function with the name:
N
N
e
e
w
w
t
t
o
o
n
n that implements the Newton
descent algorithm for minimizing the aforementioned function. The
calling syntax of this function should be:
“[MinPoints,xVals] =
N
N
e
e
w
w
t
t
o
o
n
n(fun, x, maxIterNum, tol)”
“fun” is the function name “@funToMin”, x is a row vector with the
user’s guess (starting value) about the minimum of the function.
“maxIterNum” is as before the maximum number of iterations that
should be set to 25 if not specified and tol is the tolerance concerning
the norm of the updating component of the point x (stopping criterion)
and should be set to 1e-6 is not specified. The function returns
“MinPoints” that given that the algorithm has converged, it is the
point where the minimum is located, and “xVals” that is an m-by-2
array with the set of the values of x at each iteration of the algorithm
(m is either equal to “maxIterNum” or a smaller number if the
algorithm converges earlier).
This function should call another function with the name:
NumerHessian.m and with the following calling syntax:
“HessVals = NumerHessian(fun,x)”
that takes as input a function and a single coordinate point and
returns the Hessian at that point. Use the finite two sided difference
method explained before. To avoid the calculation of a singular
Hessian that cannot be inverted, after saving the Hessian to a square
matrix, set equal to zero all its off diagonal elements. This is a very
useful rule of thumb that helps the algorithm convergence and
robustness. Use x
0
=[0 0] as initial estimate for the minimum.
After you have called the function, create a new contour figure of the
function and plot on it the algorithm’s trajectory to the minimum
found in “xVals”. Call once more the function with x0=[-1 -2] and add
the new trajectory to the contour figure. Use
g
g
t
t
e
e
x
x
t
t
to enter a text that
indicates the trajectory.
Przeglądanie stron 111

Komentarze do niniejszej Instrukcji

Brak uwag