In the following parts of this question, write a MATLAB code to solve a linear system...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In the following parts of this question, write a MATLAB code to solve a linear system Axb (A is a square nonsingular matrix) using Jacobi and Gauss-Seidel algorithms. Do not use the built-in MATLAB functions for solving linear systems. (a) Write a MATLAB function called Jacobi that takes a square n x n matrix A, and an n x 1 vector b as input, and uses the Jacobi technique to solve the system Ax = b, starting with the zero vector as the initial guess. Your function should stop when 2-norm of the difference between two successive iterates is less than 10-6, or if your function has performed 1000 iterations without reaching the termination condition. Your function must produce the value of x when the function terminates, along with the number of iterations performed to that point. (b) Write a MATLAB function called GSeidel, which takes the same parameters as the function Jacobi described in part (a), and uses the Gauss-Seidel technique to solve Ax = b. (c) Consider the following n x n system, for values of n > 1: n 1 ... 21 1 n 1 22 = ... n Solve this system using the Jacobi and Gauss-Seidel functions for the values of n equal to 10, 100, and 1000. Note, that exact solution of this system is x = 2n-1,1 = 1, 2,..., n. Produce a table of results, where each row contains the following information: the value of n the relative error in the Jacobi solution x; compared to the exact solution, it;, the number of iterations required by Jacobi, the relative error in the Gauss-Seidel solution x, compared to the exact solution, itg, the number of iterations required by Gauss-Seidel for n In the following parts of this question, write a MATLAB code to solve a linear system Axb (A is a square nonsingular matrix) using Jacobi and Gauss-Seidel algorithms. Do not use the built-in MATLAB functions for solving linear systems. (a) Write a MATLAB function called Jacobi that takes a square n x n matrix A, and an n x 1 vector b as input, and uses the Jacobi technique to solve the system Ax = b, starting with the zero vector as the initial guess. Your function should stop when 2-norm of the difference between two successive iterates is less than 10-6, or if your function has performed 1000 iterations without reaching the termination condition. Your function must produce the value of x when the function terminates, along with the number of iterations performed to that point. (b) Write a MATLAB function called GSeidel, which takes the same parameters as the function Jacobi described in part (a), and uses the Gauss-Seidel technique to solve Ax = b. (c) Consider the following n x n system, for values of n > 1: n 1 ... 21 1 n 1 22 = ... n Solve this system using the Jacobi and Gauss-Seidel functions for the values of n equal to 10, 100, and 1000. Note, that exact solution of this system is x = 2n-1,1 = 1, 2,..., n. Produce a table of results, where each row contains the following information: the value of n the relative error in the Jacobi solution x; compared to the exact solution, it;, the number of iterations required by Jacobi, the relative error in the Gauss-Seidel solution x, compared to the exact solution, itg, the number of iterations required by Gauss-Seidel for n
Expert Answer:
Answer rating: 100% (QA)
matlab Part a Jacobi function function x it JacobiA b n lengthb x zerosn 1 xnew x tol 1e6 maxiter 10... View the full answer
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these computer engineering questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Depreciation policy is an important decision made by a company's Finance Director. A company has purchased some equipment for 85,000, with an estimated scrap value of 9,000 at the end of its useful...
-
If a tracheostomy bypasses the upper respiratory passages, how might the air entering the trachea differ from air normally passing through this tube? What problems might this cause for the patient?
-
Suppose some 235 U + ions are present in the beam. They have the same charge as the 238U+ ions but a smaller mass (approximately 0.987 37m). (a) With what speed do the 235 U + ions emerge from the...
-
Jack DeCoster owned Quality Egg, LLC, an Iowa egg production company. Jacks son, Peter DeCoster, served as the companys chief operating officer. Jack also owned and operated several egg production...
-
Refer to the gasoline sales time series data in Table. a. Compute four- and five-week moving averages for the time series. b. Compute the MSE for the four- and five-week moving average forecasts. c....
-
In some ways, a qualitative portfolio manager could never really be an index portfolio manager, whereas a quantitative portfolio manager could be. Explain why.
-
Irving lives in Apple town, and plans to drive along Highway 42, a straight highway that leads to Banneton, located 146 miles east and 28 miles north. Carol lives in Coconut Ville, located 99 miles...
-
A 17-year-old minor lived away from home with a woman who gave her free room and board in exchange for household chores. The girl made her own financial decisions and "managed her own affairs." Even...
-
Calculate a Froude number m An L = 507 m sho is cruising in the acean at a speed of 15d. What is the Froude ramber? Express your answet to three signisicant figures. Vierw Avallable Hin(s)
-
How to determine the process capability if the process is not stable under the normal distribution, state with an example?
-
Provide overall recommendations to business Model advantages/disadvantages Performance evaluation Model recommendation Summary analytics recommendations
-
A block of mass 501 g is pushed against the spring (located on the left-hand side of the track) and compresses the spring a distance 4.7 cm from its equilibrium position (as shown in the figure...
-
Determine whether each of the following statements is (i) always true, (ii) sometimes true, or (iii) never true. For those that are 00 sometimes true, explain when the statement is true. a. A...
-
Suppose that you could invest in the following projects but have only $30,000 to invest. How would you make your decision and which projects would you invest in? Project Cost $ 8,000 11,000 9,000...
-
Transform Figure 2-15a, attribute version, to 3NF relations. Transform Figure 2-15b, relationship version, to 3NF relations. Compare these two sets of 3NF relations with those in Figure 4-10. What...
-
What is the difference between "schema on write" and "schema on read"?
-
Explain four reasons why the quality of data is poor in many organizations.
-
In a hypothesis test the p value is 0.043. This means that we can find statistical significance at: (1) both the 0.05 and 0.01 levels (2) the 0.05 but not at the 0.01 level (3) the 0.01 but not at...
-
In testing the null hypothesis that p = 0:3 against the alternative that p 0:3, the probability of a type II error is ______ when the true p = 0:4 than when p = 0:6. (1) the same (2) smaller (3)...
-
An article states there is no significant evidence that median income increased. The implied null hypothesis is: (1) Median income increased. (2) Median income changed. (3) Median income did not...
Study smarter with the SolutionInn App