To implement the multidimensional Newton Method in MATLAB, we need to first define the function f(x) = 0 (with x, 0 r n ) in a separate MATLAB function. Then, we need to write another function mynewton that will solve for the root of f(x) using the Newton Method.
However, the Newton Method requires the Jacobian of f(x), which is not provided in MATLAB. Therefore, we need to approximate the Jacobian using finite difference equations.
The following code shows how to implement the multidimensional Newton Method with the Jacobian approximated by finite difference equations:
main.m1093 chars45 lines
This implementation is flexible enough to handle any function f(x) without knowing the Jacobian a priori, as long as it's provided as an input argument to mynewton.
gistlibby LogSnag