Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Answer in matlab code use comments to know what your thinking is as you write the code. Explain what variables mean. Verify the code works.
Answer in matlab code use comments to know what your thinking is as you write the code. Explain what variables mean. Verify the code works. Thanks
Consider again the linear system from Problem 1. Note that once the system above is rearranged the coefficient matrix A is diagonally dominant. a) Repeat the calculation you did for problem 1b using Gauss-Seidel iteration (use GS.m or your own version) to solve the linear system for each V2 value. Use an initial guess of I- [0, 0, 0, 0] for all cases and use a stopping criterion of &,- 1E-4. Page 2 of 3 ENGR&240 Applied Numerical Methods b) Repeat the calculation for part (a) using Jacobi iteration. You will need to write your own function to do this iteration (you can modify GS.m with only one or two small changes depending on how you do it). Use an initial guess of I- [0, 0, 0, 0] for all cases and use a stopping criterion of e, IE-4. Note that these solutions may take more than 50 iterations each to converge c) For the two iterative solutions for parts (a) and (b), determine the average number of iterations required for convergence in each case. Save your result in a two-element row vector (Gauss-Seidel first, Jacobi second) d) Calculate the Euclidean norm of the residuals vector for each of the Gauss-Seidel solutions and store the results in a column vector (241x1). ANSWERS: Write your results (241x4) for parts (a) and (b) to A5.dat and A6.dat respectively. Write your average iteration counts from part(c) to A7.dat (1x2). Write your vector of residuals norms from part (d) to A8.dat (241x1). Consider again the linear system from Problem 1. Note that once the system above is rearranged the coefficient matrix A is diagonally dominant. a) Repeat the calculation you did for problem 1b using Gauss-Seidel iteration (use GS.m or your own version) to solve the linear system for each V2 value. Use an initial guess of I- [0, 0, 0, 0] for all cases and use a stopping criterion of &,- 1E-4. Page 2 of 3 ENGR&240 Applied Numerical Methods b) Repeat the calculation for part (a) using Jacobi iteration. You will need to write your own function to do this iteration (you can modify GS.m with only one or two small changes depending on how you do it). Use an initial guess of I- [0, 0, 0, 0] for all cases and use a stopping criterion of e, IE-4. Note that these solutions may take more than 50 iterations each to converge c) For the two iterative solutions for parts (a) and (b), determine the average number of iterations required for convergence in each case. Save your result in a two-element row vector (Gauss-Seidel first, Jacobi second) d) Calculate the Euclidean norm of the residuals vector for each of the Gauss-Seidel solutions and store the results in a column vector (241x1). ANSWERS: Write your results (241x4) for parts (a) and (b) to A5.dat and A6.dat respectively. Write your average iteration counts from part(c) to A7.dat (1x2). Write your vector of residuals norms from part (d) to A8.dat (241x1) 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