Here is an implementation of the multidimensional Newton method for solving the equation f(x) = 0 with x of size n, in a Matlab function mynewton
:
main.m878 chars37 lines
To use this function, you need to define a function handle to f(x)
and df(x)
. For example, to solve f(x) = x^2 - 2
, you can define:
main.m299 chars12 lines
This will output:
main.m45 chars3 lines
gistlibby LogSnag