Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a computer program to solve the following system of equations ( employ initial guesses of 0 . 0 for all unknowns ) : -
Develop a computer program to solve the following system of equations
employ initial guesses of
for all
unknowns
:
j
k
l
m
j
k
l
n
k
l
m
j
l
m
n
j
k
m
n
using the following two methods:
a
Gauss
Seidel
b
Jacobi
Perform iterations until the approximation error is
and then comment on the obtained results.
Please follow the below given details and i need the exact solution of the problem.
IMP Note:
For this problem, it is mandatory to use MatLab. However, you are not allowed to use any built in functions in MatLab that are not available in the other compilers.
Below is the code given to me but not getting the output. resolve it
Given system of equations
A ;
;
;
;
;
b ; ; ; ; ;
Initial guess
x; ; ; ; ;
GaussSeidel Method
dispGaussSeidel Method:;
xgs iterationsgs gaussSeidelA b x;
dispSolution after numstriterationsgs iterations:;
dispxgs;
Jacobi Method
dispJacobi Method:;
xjacobi, iterationsjacobi jacobiA b x;
dispSolution after numstriterationsjacobi iterations:;
dispxjacobi;
GaussSeidel method function
function x iterations gaussSeidelA b x tolerance
n lengthb;
x x;
xprev xtolerance; to enter the while loop
iterations ;
while normx xprev, inf tolerance
xprev x;
for i :n
xibi Ai:ix:i Aii:nxprevi:n Aii;
end
iterations iterations ;
end
end
Jacobi method function
function x iterations jacobiA b x tolerance
n lengthb;
x x;
xprev xtolerance; to enter the while loop
iterations ;
while normx xprev, inf tolerance
xprev x;
for i :n
xibi Ai: xprev Aii xprevi Aii;
end
iterations iterations ;
end
end.
MIMP : GaussSeidel Method:
Unrecognized function or variable 'gaussSeidel'. I want the solution of this error and give me proper code along eith proper iterations showing each and every steps.
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