Question: Complete using Matlab Generate square (nxn) matrices with random elements and n of 5,50, 100, 150, 200, 400,600, 800, 1000. Measure how long it takes
Generate square (nxn) matrices with random elements and n of 5,50, 100, 150, 200, 400,600, 800, 1000. Measure how long it takes Matlab to calculate the inverse of each matrix by run- ning tic; inv (A); time.needed toc;. Plot the time taken versus matrix size. Plot log time.needed versus log n. How does the calculation time change as n gets bigger? Do a simple linear regression of log(time) as a function of log(n) and report the slope of the regression line. What slope would you expect if the calculation time was proportional to the number of arithmetic operations required to find the matrix inverse
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
