Question: 1. (15 pts) Write down a MATLAB code testing Jacobi iterative method to solve the system of linear equations, Ax-b, where A is a 5

1. (15 pts) Write down a MATLAB code testing Jacobi iterative method to solve the system of linear equations, Ax-b, where A is a 5 5 matrix and b a 5-elements vector of random integers (use "randi" with range between -10 and +10 to select the values). Set A(i, i) = ? Ai, k)| ?! to enforce the matrix to be diagonal dominant. Compute the true solution (x-A b), the diagonal matrix (D), and the off-diagonal matrix (O) and set the iterative procedure Stop the iterations when the 2-norm of (x,-xk) is less than 10-6. Print out the final values for xk, the 2-norm, and number of iterations. 2. (20 pts) Write down a MATLAB code readi ng the system generated in problem I and use Gauss-Siedel to solve it. Stop the iterations when the 2-norm of (x-xis less than 10 Print out the final values for the 2-norm, and number of iterations 1. (15 pts) Write down a MATLAB code testing Jacobi iterative method to solve the system of linear equations, Ax-b, where A is a 5 5 matrix and b a 5-elements vector of random integers (use "randi" with range between -10 and +10 to select the values). Set A(i, i) = ? Ai, k)| ?! to enforce the matrix to be diagonal dominant. Compute the true solution (x-A b), the diagonal matrix (D), and the off-diagonal matrix (O) and set the iterative procedure Stop the iterations when the 2-norm of (x,-xk) is less than 10-6. Print out the final values for xk, the 2-norm, and number of iterations. 2. (20 pts) Write down a MATLAB code readi ng the system generated in problem I and use Gauss-Siedel to solve it. Stop the iterations when the 2-norm of (x-xis less than 10 Print out the final values for the 2-norm, and number of iterations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
