Question: This is a matlab question Problem 2.3 In a Matlab script create a standard non-sparse matri (500 rows, 3 columns). All entries in columns 1
Problem 2.3 In a Matlab script create a standard non-sparse matri (500 rows, 3 columns). All entries in columns 1 and 3 should be -1 and all entries in column 2 should have the value 2. Use the spdiags function to create a 500 x 500 sparse tri-diagonal matrix, A. The diagonal and 2 off-diagonals should be the columns of the 500 3 matrix. Next create a non-sparse version of A (using the full function) and call it B. Use the 'whos' command to compare the sizes (in computer memory) of the 2 matrices. Us- ing the tic' and 'toc' functions compare how long it takes to calculate A2 and B2. Is there much of a difference? Call the matrices in MATLAB A and B as indicated in the question. In the template there is already code for calling the 'whos' function and calculating the memory required for A and B you may want to use this in your answer of this question. Name the script containing your answer Q2_3.m and do not forget to answer any questions in the 'conclusions: comment at the end of the script. x with size 500 x 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
