Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve in MATLAB using the Gauss-Seidel Method Consider the linear system A, 0 =p, where A, is an nxn matrix with 2's on the

Please solve in MATLAB using the Gauss-Seidel Method

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Consider the linear system A, 0 =p, where A, is an nxn matrix with 2's on the main diagonal, -1's directly above and below the main diagonal and O's everywhere else. For example, 1 2 -1 0 0 0 1 | -1 2 -1 0 0 Az = 0 -1 2 -1 0 0) -1 2 -1 To 0 0 -1 2 ) This is a discretized version of Poisson's equation d?$(x) = P(x), dr2 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(v), diag(v, 1) and diag(v, -1) do when vis a vector.) Save your matrix in a variable named A. In addition, construct the 103 x 1 vector p such that the th entry of p is defined according ot the formula 0;=2(1-os (174)) sin (104) Save this vector in a variable named rho. The Gauss-Seidel method for this problem can be written as $k = M0k-1+c. (Note that O means the kth guess for Q and it is an entire vector. It does not mean the kth entry of 0.) Find the largest in magnitude) eigenvalue of M and save the magnitude of this eigenvalue in a variable named ans1. (Remember, you can use the abs function to find the magnitude of a number. Your answer should be a positive, real number.) Use the Gauss-Seidel method to solve for 0. Your initial guess should be a 103 x 1 vector of all ones, and you should use a tolerance of 10-5. That is, you should stop when 110x - 0k-illo

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions