Programming Homework Help

Oklahoma State University MATLAB Matrix Functions Report

 

Write a file, named p7.m, which contains the definition of a MATLAB function named p7. The function p7 will accept two parameters, both 2D matrices. It will return seven results. The first will be the number of rows in the first matrix passed, the second the number of columns. The third result is the number of columns in the second matrix, the fourth the number of rows. If the number of columns in the first matrix passed does not equal the number of rows in the second, no further processing is to be performed and the remaining results are to be scalar values of 0, the function then returning. If both the number of rows in the first matrix and the number of columns in the second are not greater than 2, the last three results are to be set to -1, the function then returning. Assuming the two conditions above did not apply, the remaining three results are to be the product of the first matrix times the second matrix, the product of the first two rows of the first matrix times the first two columns of the second, and the product of the transpose of the second matrix times the transpose of the first.