Finding Jacobian matrix for Newton's method

3 vues (au cours des 30 derniers jours)
Jenn Lee
Jenn Lee le 13 Avr 2012
Commenté : Walter Roberson le 8 Août 2019
I have a very basic newton's method that uses a loop and:
y = Jac(x)\(-F(x));
x = x + y;
to solve for the approximate solution.
Where x is a the initial guess in the form of a vector, F is the nonlinear function, and Jac is the jacobian matrix. Currently, I am inputting the jacobian by hand.
For example, system of equations =
2x(1) + x(2)
3x(1) + x(2)^2
=> Jac(x) =
[2, 1; 3, 2x(2)]
I was wondering if instead of solving it by hand if I could get Matlab to do it for me.

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Avr 2012
If you have the symbolic toolbox you can use the jacobian() function.
  2 commentaires
Jenn Lee
Jenn Lee le 14 Avr 2012
is there a way to code this?
Walter Roberson
Walter Roberson le 8 Août 2019
x = sym('x', [1 2]);
eqn = [2*x(1) + x(2)
3*x(1) + x(2)^2];
jacobian(eqn, x)

Connectez-vous pour commenter.

Plus de réponses (1)

DIPANKAR POREY
DIPANKAR POREY le 7 Août 2019
2x(1) + x(2)
3x(1) + x(2)^2
=> Jac(x) =
[2, 1; 3, 2x(2)]
  1 commentaire
Walter Roberson
Walter Roberson le 8 Août 2019
This does not appear to be an answer? It appears to be a copy of part of the question.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by