How to create a jacobian matrix for newton methods using multiple variables

71 views (last 30 days)
I am trying to create a jacobian matrix using the equations
f1= x^2 +2x+2y^2-26 and f2=2x^3-y^2+4y-19
I haven't seen other codes that use more of the same variable (x^2, 2x) per equation, usually it's one x and one y variable. Does anyone have any advice or ideas on how to create the matrix?

Accepted Answer

Walter Roberson
Walter Roberson on 19 Oct 2015
If you have the symbolic toolbox, then
syms x y
f1 = x^2 +2*x+2*y^2-26
f2 = 2*x^3-y^2+4*y-19
jacobian([f1, f2], [x,y])
If you do not have the symbolic toolbox then you will need to do the computations the usual way,
[diff(f1,x), diff(f1, y); diff(f2, x), diff(f2, y)]

More Answers (0)

Community Treasure Hunt

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

Start Hunting!