Finding Jacobian matrix for Newton's method

조회 수: 20 (최근 30일)
Jenn Lee
Jenn Lee 2012년 4월 13일
댓글: Walter Roberson 2019년 8월 8일
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.

채택된 답변

Walter Roberson
Walter Roberson 2012년 4월 13일
If you have the symbolic toolbox you can use the jacobian() function.
  댓글 수: 2
Jenn Lee
Jenn Lee 2012년 4월 14일
is there a way to code this?
Walter Roberson
Walter Roberson 2019년 8월 8일
x = sym('x', [1 2]);
eqn = [2*x(1) + x(2)
3*x(1) + x(2)^2];
jacobian(eqn, x)

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

추가 답변 (1개)

DIPANKAR POREY
DIPANKAR POREY 2019년 8월 7일
2x(1) + x(2)
3x(1) + x(2)^2
=> Jac(x) =
[2, 1; 3, 2x(2)]
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 8월 8일
This does not appear to be an answer? It appears to be a copy of part of the question.

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

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by