Question: Problem 1. Write a MATLAB script called oddindex that takes a matrix, M, as input argument and creates a matrix that contains only those elements

 Problem 1. Write a MATLAB script called oddindex that takes a

Problem 1. Write a MATLAB script called oddindex that takes a matrix, M, as input argument and creates a matrix that contains only those elements of M that are in odd rows and columns. In other words, it would return the elements of M at indices (1,1), (1,3), (1,5), ..., (3,1), (3,3), (3,5), ..., etc. Note that both the row and the column of an element must be odd to be included in the output. The following would not be returned: (1,2), (2,1), (2,2) because either the row or the column or both are even. As an example, if M were a 5-by-8 matrix, then the output must be 3-by-4 because the MATLAB Script omits rows 2 and 4 of M and it also omits columns 2, 4, 6, and 8 of M. Test your Code with M-41:50:31:40; 21:30; 11:20; 1:10] and provide the output. [4ros rows were ait 2.1), (2)

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!