Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In a Matlab script create a standard non-sparse matrix with size 500 3 (500 rows, 3 columns). All entries in columns 1 and 3 should

In a Matlab script create a standard non-sparse matrix with size 500 3 (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 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. Using the `tic' and `toc' functions compare how long it takes to calculate A^2 and B^2 . Is there much of a difference?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions