Question: 1. Write a custom matlab function m-file that takes as its input argument a value in inches. The function should return the value in feet

1. Write a custom matlab function m-file that takes as its input argument a value in inches. The function should return the value in feet as an output argument. (There are 12 inches per foot). Use your function to convert 36 inches to its value in feet and store that value in a variable in the main workspace. 2. Write a custom matlab function m-file that takes as its input arguments the radius and length of the cylinder. The function should return the surface area and volume of the cylinder as output arguments. (The formulas are SA = 2rL + 280r2, V = ar?L.) Use your function to calculate the surface area and volume of a cylinder with radius 4 and length of 10, and to store those values in two variables within the main workspace. 3. Write an anonymous matlab function that takes as its input argument a one- dimensional array of numbers (a vector) and returns the average of the elements in the array, WITHOUT using the built-in mean function (Hint: use the sum and length functions instead.) Use your function to calculate the average of any numerical vector. 4. Write a custom matlab function m-file that takes as its input arguments a vector of any length. The function should return two vectors, with the first vector consisting of the 1st half of the input vector and the second vector consisting of the 2ndhalf. This must work whether your vector has an even or odd length. Use the length and fix functions to help with this. (Hint: Try to do it with a vector of even length first. 5. Determine (and demonstrate) the matlab code for accessing the submatrix from row m-2 to m-1 and column n-2 to n-1 of any m x n matrix (that is at least 3x3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
