Question: 1. Problems (40pts) (a) (15pts) Write MATLAB code to prompt the user to enter the height in cm. The code will then compute the height
1. Problems (40pts) (a) (15pts) Write MATLAB code to prompt the user to enter the height in cm. The code will then compute the height in feet and inches. Recall that 1 foot- 12 inches 30.48cm. For example, if the user enters 178, the code should compute feet-5 inches = 10.0787 (b) (10pts) Write MATLAB code to prompt the user to enter an integer and then compute the number of digits. For example, if the user enters 43521, then the code should compute 5. As another example, if the user enters 3219, then the code should compute 4 Hint: You may find that the log10 and floor functions are useful. (c) (15pts) Write MATLAB code to prompt the user to enter an integer and then compute the sum of the first three digits. For example, if the user enters 54367, then the code should compute 12 since 5+4 +3=12. Hint: You may find the solution to the previous problem helpful as well as the functions floor and rem. 2. Matrices (20 pts) (a) (5pts) Write MATLAB code to create the following matrices (use the operator: whenever possible): 12 10 8 4 7 10 -3 0 3 B=141-2-5 9 13 17 21 (b) (3pts) Assign to x the element in row 4 and column 1 of A (c) (3pts) Assign to y the second row of B (d) (3pts) Assign to z the block of elements in A at the intersection of rows 2,3,4 and columns 1,2 (e) (3pts) Delete the first row of B (1) (3pts) Change the second column of A to 1,1,2,2 3. Plotting (40pts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
