MatLab Assignment 7 -- Turn in on October 31



  1. Page 188: 2(a)(b), 8(a)(b)
    For each system, first define matrices: D, L and U; set vector d and initial estimate x(0), and then carry the fixed-point iteration for each method.
  2. Solve Ax=b where A is a 10x10 tridiagonal matrix with 4's on its diagonal and -1's on its off diagonal and vector b contains all ones. You may use MatLab commands to initialize matrix A and b as follows.
         >> n=10;
         >> A=4*diag(ones(n,1))-diag(ones(n-1,1),-1)-diag(ones(n-1,1),1);
         >> b=ones(n,1);
    
    Use help diag to learn more about diag and to use it to initialize matrices L and U.
    Let x(0)=0. Define r(k)=Ax(k)-b. Find x(k) such that the square root of (r(k))Tr(k) is less than 10-3 using (1) Jacobi iteration; and (2) Gauss-Seidel iteration. Print out x(k) and k for each method.