Question: Develop your own M-file function for the Gauss- Seidel method without relaxation based on Fig. 12.2, but change the first line so that it returns
Develop your own M-file function for the Gauss- Seidel method without relaxation based on Fig. 12.2, but change the first line so that it returns the approximate error and the number of iterations:
function [x,ea,iter] = ...
Gauss Seidel (A,b,es, maxit)

Test it by duplicating Example 12.1 and then use it to solve Prob. 12.2a.
Example 12.1

Data From Problem 12.2
(a) Use the Gauss-Seidel method to solve the following system until the percent relative error falls below εs = 5%:

(b) Repeat (a) but use overrelaxation with λ = 1.2.
function x = Gauss Seidel (A, b, es, maxit) & GaussSeidel: Gauss Seidel method $ x = GaussSeidel (A,b): Gauss Seidel without relaxation & input: .. A = coefficient matrix 8 bright hand side vector 8 es = stop criterion (default = 0.000018) 8 maxit = max iterations (default = 50) $output: 8 x = solution vector if nargin
Step by Step Solution
3.48 Rating (164 Votes )
There are 3 Steps involved in it
The question provides a MATLAB Mfile function for the GaussSeidel iterative method for solving linear systems and asks to modify the function to retur... View full answer
Get step-by-step solutions from verified subject matter experts
