Homework #2 1. Create a vector starting at -5, incremented by 0.5, and ending at 5. Store the values as the variable x 2
Posted: Sat Feb 26, 2022 11:46 am
Homework #2 1. Create a vector starting at -5, incremented by 0.5, and ending at 5. Store the values as the variable x 2. Find the square root of all the values in x using two methods: a. Raise the variable to the (1/2) power. b. Use the built-in function for calculating square roots. 3. Find the absolute value of the values in x using two methods. Store the absolute values as the vector y using either method. a. Using the built-in function for absolute value. b. Using the built-in function for finding the sign of a value. (This will require some thought and math) 4. Calculate the 4th root of the values in y (7) using the built-in function for finding roots. 5. Raise the natural number (e) to the power of every value in x (e*). 6. Calculate the natural log of 14.5 then round up the answer to the nearest 2 decimal places. 7. Calculate the log (base 10) of 7000 and round it down to the nearest integer. Store this value as the variable z. 8. Using one of MATLAB's built-in functions, find the factorial of z. 9. In one command, determine how many prime numbers exist between 0 and 10,000. (You will have to use two built-in functions to do this) 10. A matrix is stored in the workspace as the variable W. what command would you type to determine the number of rows and columns in the matrix W? 11. Create a vector staring at -27, incremented by 0.47, and ending at 21. Save the vector as the variable TH. (This is a vector of angles in radians) 12. Find the sine of all the variables in TH. 13. In a single command, use built-in functions to determine the average of the cosines of the values in TH. 14. Create a new vector TH D by converting the values in TH to angles in degrees. Then, find the tangents of these angles in degrees. (Hint: 1 rad (19) deg) 15. Create a new vector named a which starts at -1, ends at 1, and contains 50 values. a. Find the aresine of these values in radians. i. Use a built-in function to find the smallest angle in this result. b. Find the arccosine of these values in degrees. i. Use a built-in function to find the largest angle in this result. 16. Consider the matrix W from Problem #10. . Find the maximum value in each column of W and the row in which it occurs. b. Find the maximum value in each row of W and the column in which it occurs. 17. Create a matrix of random numbers between 0 and 1 with 5 rows and 10 columns 18. Create a column vector containing 15 values of random numbers between 0 and 19. You are in the laboratory measuring internal stresses in a beam. Your stress measurement device stores the stress values in column vector called STRESSES. Redefine the vector sorting the stresses from highest stress to lowest stress. 20. Imagine now that the variable STRESSES is a matrix containing stress values in the first column and the location of the stress along the beam in the second column. Sort the values of the stresses from smallest stress to largest stress ensuring that the location of the stress stays next to its corresponding stress value.