Question: 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

 3. Write an anonymous matlab function that takes as its input

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 1sthalf 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 mxn matrix (that is at least 3x3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!