Newton for a 4x4 system of nonlinear eqns

Click For Summary
SUMMARY

The discussion focuses on implementing the Newton-Raphson method for solving a nonlinear 4x4 system of equations using MATLAB. A user shared their MATLAB code, which includes symbolic definitions for variables and the Jacobian matrix. The user reported that their method converged in three iterations instead of the expected one for a linear system, prompting questions about potential errors in their implementation. The conversation highlights the importance of correctly setting up the Jacobian and initial guesses for convergence.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of the Newton-Raphson method for nonlinear equations
  • Knowledge of symbolic mathematics in MATLAB
  • Basic concepts of Jacobian matrices
NEXT STEPS
  • Review MATLAB's symbolic toolbox for advanced equation handling
  • Study the convergence criteria for the Newton-Raphson method
  • Learn about Jacobian matrix calculation for nonlinear systems
  • Explore error analysis in iterative methods for better debugging
USEFUL FOR

Mathematics students, engineers, and researchers working on numerical methods for solving nonlinear equations, particularly those using MATLAB for simulations and modeling.

Moly
Messages
20
Reaction score
0
Hi All.
Can somebody give me a sample MATLAB code for Newton-Raphson Method for Nonlinear 4x4 System of Equations. I'm trying to set a very ugly one up and haven't seen NR before the beginning of this week. I've figured the NR for a single eqn but this is driving me nuts.
 
Physics news on Phys.org
Hi All. I think i figured it out... i am attaching the program below for a linear set of eqns... that was just to verify that all is working well... however, i was told that the method should converge in one iteration for a linear system, and for me it happens in 3.. am i doing something wrong here:

clear all
close all

syms x y z k
f1=x-2*y+0*z+3*k+2;
f2=0*x+y+0*z-4*k-7;
f3=0*x-0*y+z+0*k-6;
f4=0*x-0*y+0*z+k+3;

Jk=zeros(4,4);
Jk=[1 -2 0 3;
1 -1 0 -4;
1 -2 1 3;
1 -2 1 4];

x1=2; x2=-5; x3=-4; x4=-1;
xxold=[2;-5;-4;-1]
for i=1:4
F=[subs(f1, {x,y,z,k},{x1,x2,x3,x4});
subs(f2, {x,y,z,k},{x1,x2,x3,x4});
subs(f3, {x,y,z,k},{x1,x2,x3,x4});
subs(f4, {x,y,z,k},{x1,x2,x3,x4})];
xx=xxold-inv(Jk)*F;
x1=xx(1); x2=xx(2);x3=xx(3);x4=xx(4);
xxold=xx
end
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
Replies
1
Views
4K