SOLUTION EGR115 2008 Spring HW04: Class Exercise Due: End of class: Mon/Tue, Mar 31 / Apr 01 You will achieve the best results in answering these questions by combining READING with EXPERIMENTATION . Use the F1 key in MATLAB to access the online help; experiment by trying things in MATLAB's command window. 1. There are times when matrix math requires the use of an “identity matrix”. What is the MATLAB command to create a 3x4 identity matrix? eye(3,4) 2. a. What is the MATLAB function that will create an array of all zeros? zeros() b. What is the MATLAB function that will create an array of all ones? ones() 3. Write a single MATLAB statement that will create a 300x200 array of all sevens. a = 7 * ones(300, 200) 4. Using the rand() function, provide a MATLAB statement to create a 3x5 array, x , with random values between 0 and 1. x = rand(3, 5) 5. Using the rand() function, provide a MATLAB statement that will create a 3x5 array, x , with random values between 1 and 100, inclusive. x = rand(3,5)*99 + 1
This is the end of the preview. Sign up
access the rest of the document.