Question: Exercise 1.1.10 Write a MATLAB program that performs matrix-vector multiplication two A*x, and (b) using different ways: (a) using the built-in MATLAB command b loops,

 Exercise 1.1.10 Write a MATLAB program that performs matrix-vector multiplication two
A*x, and (b) using different ways: (a) using the built-in MATLAB command

Exercise 1.1.10 Write a MATLAB program that performs matrix-vector multiplication two A*x, and (b) using different ways: (a) using the built-in MATLAB command b loops, as follows. b - zeros (n,1); for j l:n for i = 1:n end end Time the two different methods on matrices of various sizes. Which method is faster? (You may want to use some of the code from Exercise 1.1.9.) 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 b A*x; = end matrixsize = n time cputime -t if jay > 1 ratio- time/oldtime end n 2*n; end e syntax is simple enough that you can readily figure out what the program does. ecornmands randn and b = A*x are familiar from the 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 Th dimension 500, 1000, 2000, and 4000

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