Question: using matlab Let's see how long it takes to solve a sparse matrix equation when the matrix is banded. The matrix can be random, so
using matlab
Let's see how long it takes to solve a sparse matrix equation when the matrix is banded. The matrix can be random, so spdiags can be used since we don't care exactly how the columns of B are inserted into the matrix. For example, a sparse, random, tridiagonal matrix can be easily generated by n = .....; B = rand(n, 3); S = spdiags(B, [-1:1], n, n); a) Time a tridiagonal matrix. (i) Time a pentadiagonal matrix, but again it only has three nonzero diagonals. That is, the -2, 0, and +2 diagonals are nonzero. (ii) Time a matrix which again only has three nonzero diagonals, but now they are the -4, 0, and +4 diagonals
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
