The function spdiags extracts and creates sparse band and diagonal matrices and is a generalization of the MATLAB function diag. We will only use one of its various forms. To create a pentadiagonal...


The function spdiags extracts and creates sparse band and diagonal matrices and is a generalization of the MATLAB function diag. We will only use one of its various forms. To create a pentadiagonal matrix, create vectors that specify the diagonals. We will call these diagonals

1

2

3

4

5
 where

1

2
are the subdiagonals and

4

5
are the superdiagonals. For an
 matrix, each vector must have length To create the matrix, execute


The parameter -2:2 specifies that the diagonals are located at offsets
 and
 from the main diagonal.



 Create a
 pentadiagonal matrix with sub- and superdiagonals
T
and diagonal

T
 Show the matrix is positive definite, with an approximate condition number of



 Using

0
 and a random
 apply cg using tol

−14
and maxiter
In each case, output the residual.



 Use precg with the same tolerance and niter
 Output the residual.





May 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here