Results 1 to 3 of 3

Math Help - Program for Jacobi iterative method using Matlab.

  1. #1
    Member
    Joined
    Sep 2009
    Posts
    164

    Program for Jacobi iterative method using Matlab.

    Hi All
    I need a program for Jacobi iterative method (Jacobin method for solving linear system)using Mat-lab program ,specially I need to programing the following summation

    Program for Jacobi iterative method using Matlab.-summation.bmp

    and I need to know how to do the summation such that i not equal j in mat-lab

    Thanks for all
    Last edited by mr fantastic; November 16th 2010 at 02:27 AM. Reason: Re-titled.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Well, CB is our resident MATLAB expert, but you could just sum from 1 to i-1, and then from i+1 to n, taking into account the special cases like i = 1 or i = n. You could do all that in a subroutine.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by raed View Post
    Hi All
    I need a program for Jacobi iterative method (Jacobin method for solving linear system)using Mat-lab program ,specially I need to programing the following summation

    Click image for larger version. 

Name:	summation.bmp 
Views:	199 
Size:	563.7 KB 
ID:	19724

    and I need to know how to do the summation such that i not equal j in mat-lab

    Thanks for all
    At a guess you want:

    {\bf{X}}^{(k+1)}=({\bf{b}}-{\bf{AX}}^{(k)}-\mbox{diag}({\bf{A}},0).*{\bf{X}} )./ \mbox{diag}({\bf{A}},0)

    though I would have to check that this did what I expect specially if there is some ambuigity about row and column vectors.

    You will of course be better off going back to the definition of Jacobi iteration:

    Code:
    d=diag(A,0); %extracts the principle diagonal of A as a vector
    D=diag(d);   %creates a diagonal matrix with d down the diagonal
    R=A-D;       %remainder matrix
    
    X_new=inv(D)*(b-R*X_old);  %Jacobi iteration
    or using the fact that we know the inverse of a diagonal matrix:

    Code:
    d=diag(A,0);
    D=diag(d);
    R=A-D;
    
    X_new=(b-R*X_old)./d;


    Matlab is a vector/matrix language, don't translate vector/matrix operations into elementwise scalar operations.

    CB
    Last edited by CaptainBlack; November 17th 2010 at 01:18 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. choice of iterative method!
    Posted in the Advanced Algebra Forum
    Replies: 0
    Last Post: November 7th 2011, 03:24 AM
  2. Jacobi Method rearrangement of linear system (help!)
    Posted in the Advanced Applied Math Forum
    Replies: 1
    Last Post: March 23rd 2010, 03:20 AM
  3. mathlab--jacobi iteration method
    Posted in the Math Software Forum
    Replies: 6
    Last Post: December 10th 2008, 04:07 AM
  4. MATLAB Iterative Methods: URGENT
    Posted in the Math Software Forum
    Replies: 1
    Last Post: October 15th 2008, 07:12 AM
  5. Replies: 3
    Last Post: November 3rd 2007, 02:43 PM

Search Tags


/mathhelpforum @mathhelpforum