Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started