Question: a ) Create the matrix A by first creating a matrix of all 0 ' s , then putting in the - 2 ' s

a) Create the matrix A by first creating a matrix of all 0's, then putting in the
-2's on the main diagonal and 1's on the first upper and lower diagonals. Solve
Ax=b using backslash, and time it using 'tic' and 'toc'. Hint: Using the 'diag'
command can help here.
b) Repeat the process, but using the sparse matrix format for A. You can do
this inefficiently using the 'sparse' command to turn your matrices from part
a) into sparse format. A much better way to do this is to create the matrix
using the 'spdiags' command. The syntax to do this can be found in the help
documentation of 'spdiags' (type "help spdiags" on the command line), Is there a
timing difference between solving sparse and full matrices using backslash? How
much?
a ) Create the matrix A by first creating a

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 Programming Questions!