Matlab, code to eval Jacobian Matrix numerically

2 replies · 14K views · last reply
Gameowner
Messages
43
Reaction score
0

Homework Statement



The question is in 5 parts all mainly to do with Newton's Method, I've done parts a,b,d and e, but am struggling with the understanding of part c. They have given us the code but unsure as to how to modify my own code to suit the question.

Another problem is I don't seem to know how to run the code they gave us.



Homework Equations





The Attempt at a Solution



I've attached my code(which is the answer to part b and also what they refer to in part c as ''your Newton's method code'
 
Attachments
  • Screenshot of a MATLAB M-file defining function mynewt2, a multivariable Newton's method solver, with a for loop computing f, the Jacobian J, the update dx = J\-f, and a results table.
    mycode.jpg
    40.6 KB · Views: 2,414
  • Screenshot of MATLAB code for a function jacobian_krm(func, x) that numerically generates a Jacobian matrix of partial derivatives using finite differences, with comments describing inputs, outputs and an example.
    Given code.jpg
    25.9 KB · Views: 2,457
  • Homework problem showing a system of four nonlinear equations in x1 to x4 set equal to zero, followed by parts (a) to (e) asking for Newton's method work, a Matlab function and Jacobian, and convergence tests.
    q2.jpg
    39.7 KB · Views: 1,432
I wrote my own Newton interation solver, and it wasn't too hard to do either (once I got my Jacobian defined correctly, 4 months to figure that one out...)

My MATLAB program was it two parts, one was computing the Jacobian by computing the Jacobian using the definition of the Jacobian. The other part defined the set of equations I wish to solve, this would usually be written as a function.

What you have here are two functions. so what you have to figure out is what are the inputs of these functions and how the function makes use of them. I would post my program but I fear that I would get slapped by the mods...
 
Hola amigos necesito el de N-R pero con la derivada numérica y el jacobiano con la derivada numérica me pueden ayudar saludos