1. Engineering
  2. Computer Science
  3. exercise 1114 please thank you...

Question: exercise 1114 please thank you...

Question details
Exercise 1.1.14 please. Thank you.
Exercise 1.1.14 Modify the MATLAB code from Exercise 1.1.9 by changing the matrix-vector multiply b = A*x to a matrix-matrix multiply B-AX, where Xisnxn. You may also want to decrease the initial matrix dimension n and the number of times rep loop is executed. Run the code and check the ratios. Are they close to what you would expect therm to be. based on the flop count?
Exercise 1.1.9 Consider the following simple MATLAB program. n 500 for jay = 1:4 if jay > 1 oldtime = time ; end A randn (n) ; x = randn (n, 1) ; t cputime; for rep-1:100 % compute the product 100 times end matrixsize = n time = cputime - t if jay > 1 ratio- time/oldtime end n-2-n; end The syntax is simple enough that you can readily figure out what the program does The commands randn and b = A*x are familiar fromthe previous exercise, we perform each matrix-vector multiplication 100 times in order to build up a significant amount of computing time. The function cputime tells how much computer (central processing unit) time the current MATLAB session has used. This program times the execution of 100 matrix-vector multiplications for square matrices A of dimension 500, 1000, 2000, and 4000.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution