Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Write a function in MATLAB that takes as an input a matrix of coefficients for a system of linear equations (A), the solution vector
3. Write a function in MATLAB that takes as an input a matrix of coefficients for a system of linear equations (A), the solution vector (b), an initial guess for the solution, a tolerance, and a maximum number of iterations. Have your function output the approximate solution of the system using the Gauss Seidel Method. (Hint: first line of your script should be the following: function [result,error.count] = GaussSeidel(A,b,x0,tol)) a. Test your function on the following system and output the result, final error, and number of iterations used. Use as a measure of error the difference between the last and current estimate. System: 12x+6y+3z+p = 27 12x + 20y +12+5p = 30 7x + 18y +30+4pz= 48 6x+7y+2z+22p=5 b. Solve the matrix equation Ax=b for an exact solution of the above system. Then compute the absolute and relative error between the Gauss- Seidel estimate and the exact solution for the variable x
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