Question: Please post your matlab code. Thanks! Note: This problem is identical to the Gauss-Seidel method problem, except that you need to use the Jacobi method.

Please post your matlab code. Thanks! Note: This problem is identical toPlease post your matlab code. Thanks!

Note: This problem is identical to the Gauss-Seidel method problem, except that you need to use the Jacobi method. Consider the linear system Ad=p, where A, is an nxn matrix with 2's on the main diagonal, -I 's directly above and below the main diagonal and O's everywhere else. For example, / 2 -1 0 0 0 -1 2 -1 0 0 As = 0 -1 2 -1 0 10 0 -1 2 -1 0 0 0 -12 This is a discretized version of Poisson's equation px) dr2 which appears very often in physical applications. We will discuss discretizations and differential equations, including the origin of the matrix An, later in the class. Construct the matrix A103 in Matlab. (You should be able to do this in only a few lines with the help of the diag command. In particular, you should figure out what the commands diag(), diag(v, 1) and diag(v, -1) do when v is a vector.) Save your matrix in a variable named A. In addition, construct the 103 x I vector p such that the j th entry of p is defined according of the formula P;= 2(1-os 74 sin 300 Save this vector in a variable named rho. If you are particularly good with trigonometric identities, you can show that the exact solution to our problem is the 103 x I vector whose jth entry is defined according to the formula 0;= sin ( Save this vector in a variable named phi. The Jacobi method for this problem can be written as = M -1 +0. (Note that means the kth guess for and it is an entire vector. It does not mean the kth entry of .) Find the largest in magnitude) eigenvalue of M and save the magnitude of this eigenvalue in a variable named ans 1. (Remember, you can use the abs function to find the magnitude of a number. Your answer should be a positive, real number.) Use the Jacobi method to solve for o. Your initial guess should be a 103 x 1 vector of all ones, and you should use a tolerance of 10-. That is, you should stop when Di-DR-1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!