1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Newton for a 4x4 system of nonlinear eqns

  1. Jan 22, 2009 #1
    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.
  2. jcsd
  3. Jan 25, 2009 #2
    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

    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;
    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})];
    x1=xx(1); x2=xx(2);x3=xx(3);x4=xx(4);
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook