Question: Write a code in matlab. In this exercise, you will create, if possible, an m by n matrix A, such that, an (i, j)-entry of

Write a code in matlab. In this exercise, you will create, if possible, an m by n matrix A, such that, an (i, j)-entry of the matrix A, A(i,j), is the sum of the indexes i and j, where i runs from 1 to m and j runs from 1 to n. You can use for loop in order to construct the matrix A, given m and n.

To decide whether A can be created, you will check in your code if the given variables m and n are integer. You can use the conditional statement if else

(see for help http://www.mathworks.com/help/matlab/ref/if.html )

and a MATLAB built-in function such as mod, floor, fix. If both m and n are integer, proceed to the calculation of the entries of the matrix A. If not, the outputs have to be A = [ ] (A is an empty matrix) followed by the comment Error in using sums: both m and n must be integer.

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!