designed to solve these types of tridiagonal systems using Gauss-Seidel iteration. Write a function mfile that receives the following inputs (in order): 1. A row vector of three numbers that gives the values for the three diagonals respectively. 2. A column vector to define the right hand side ("b" vector) of the linear system. Your function should use the length (number of elements) in this second input to define the size of the linear system that it is solving. For example, inputs of [1 -2 1] and [125; 200; 100; 150] would indicate the 4x4 linear system: 4x4 Linear System Your function should solve the system using Gauss-Seidel iteration with initial guesses of 0 for all elements of x and a stopping criterion of 1e-5. The function should return the following outputs (in order): 1. A column vector of the solution, x, to the system of equations. 2. A scalar that 3. A scalar that Notes: equal to 1 if the coefficient matrix is diagonally dominant and 0 if it is not. equal to the Euclidean norm of the residuals vector associated with the solution. . Consider using the built-in function(s) diag or spdiags to efficiently build the coefficient matrix from the inputs. Consult MATLAB help for more information on these functions. The example mfile GS.m will load with the test suite, so you can call GS.m from within your function if you like.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

42

-2
1
0
1 -2
Lo 0 1
1 0
1
-2
0 1x₁
X1
0
1
x2
x3
-2][x4
X4.
||
125]
200
100
[150]
Transcribed Image Text:-2 1 0 1 -2 Lo 0 1 1 0 1 -2 0 1x₁ X1 0 1 x2 x3 -2][x4 X4. || 125] 200 100 [150]
Tridiagonal
designed
linear systems commonly arise in the context of algorithms to solve differential equations. The Gauss-Seidel method offers an efficient approach to solving these systems. For this problem you'll write a function mfile that is specifically
to solve these types of tridiagonal systems using Gauss-Seidel iteration. Write a function mfile that receives the following inputs (in order):
1. A row vector of three numbers that gives the values for the three diagonals respectively.
2. A column vector to define the right hand side ("b" vector) of the linear system. Your function should use the length (number of elements) in this second input to define the size of the linear system that it is solving.
For example, inputs of [1 -2 1] and [125; 200; 100; 150] would indicate the 4x4 linear system:
4x4 Linear System
Your function should solve the system using Gauss-Seidel iteration with initial guesses of 0 for all elements of x and a stopping criterion of 1e-5. The function should return the following outputs (in order):
1. A column vector of the solution, x, to the system of equations.
2. A scalar that is equal to 1 if the coefficient matrix is diagonally dominant and 0 if it is not
3. A scalar that is equal to the Euclidean norm of the residuals vector associated with the solution.
Notes:
▪ Consider using the built-in function(s) diag or spdiags to efficiently build the coefficient matrix from the inputs. Consult MATLAB help for more information on these functions.
▪ The example mfile GS.m will load with the test suite, so you can call GS.m from within your function if you like.
Transcribed Image Text:Tridiagonal designed linear systems commonly arise in the context of algorithms to solve differential equations. The Gauss-Seidel method offers an efficient approach to solving these systems. For this problem you'll write a function mfile that is specifically to solve these types of tridiagonal systems using Gauss-Seidel iteration. Write a function mfile that receives the following inputs (in order): 1. A row vector of three numbers that gives the values for the three diagonals respectively. 2. A column vector to define the right hand side ("b" vector) of the linear system. Your function should use the length (number of elements) in this second input to define the size of the linear system that it is solving. For example, inputs of [1 -2 1] and [125; 200; 100; 150] would indicate the 4x4 linear system: 4x4 Linear System Your function should solve the system using Gauss-Seidel iteration with initial guesses of 0 for all elements of x and a stopping criterion of 1e-5. The function should return the following outputs (in order): 1. A column vector of the solution, x, to the system of equations. 2. A scalar that is equal to 1 if the coefficient matrix is diagonally dominant and 0 if it is not 3. A scalar that is equal to the Euclidean norm of the residuals vector associated with the solution. Notes: ▪ Consider using the built-in function(s) diag or spdiags to efficiently build the coefficient matrix from the inputs. Consult MATLAB help for more information on these functions. ▪ The example mfile GS.m will load with the test suite, so you can call GS.m from within your function if you like.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY