Question: Answer the following question using MATLAB or octave and provide your code: Modify the function file gauss seidel.m to produce a new function file that

Answer the following question using MATLAB or octave and provide your code:

Modify the function file gauss seidel.m to produce a new function file that implements the Jacobi method and use it to solve:

12x1 3x2 +4x3 2x4 = 12

2x1 +10x2 x3 - 20x4 = 15

x1 x2 + 20x3 + 4x4 = 7

x1 +x2 20x3 3x4 = 5

File gauss_seidel.m

function xnew=gauss_seidel(A,b,xold)n=size(A)(1);At=A;xnew=xold;for k=1:nAt(k,k)=0;endfor k=1:nxnew(k)=(b(k)-At(k,:)*xnew)/A(k,k);end endfunction

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!