hw3 - MAE 107 Problem JDG-NA03 1.) Write a Matlab function...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MAE 107 Problem JDG-NA03 1.) Write a Matlab function cpucomp that will compare the required CPU time (on whatever platform is used) for solution of the n × 1 linear equation A x = b by means of the Matlab operations x=inv(A)*b and x=A \ b , for the case of a random (”forcing”) b= rand(n,1) . Your function should accept an n × n square matrix (A) as input and return the two times, say tinv and tbsl, along with the condition number of the matrix, in response to a function call of the form: [tinv, tbsl, c]=cpucomp(A) . Using the comment symbols %, include a brief preamble above the function definition stating what the function does and stating your name as author. (This preamble can then be displayed with the command help cpucomp . ) For a random forcing vector b= rand(n,1) , test your program on the matrices: i.) randomly rotated diagonal matrix , defined by: Q = orth(randn(n, n)); d = logspace(0,-10,n); A = Q*diag(d)*Q’; ii.) the Hilbert matrix , defined by A(i, j) =1/(i+j -1) , which may be constructed with for-loops., which may be constructed with for-loops....
View Full Document

This note was uploaded on 05/12/2010 for the course MAE 107 taught by Professor Goddard during the Winter '10 term at San Diego.

Page1 / 2

hw3 - MAE 107 Problem JDG-NA03 1.) Write a Matlab function...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online