Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following exercises are meant to be answered by few lines of MATLAB code; mo

ID: 3804610 • Letter: T

Question

The following exercises are meant to be answered by few lines of MATLAB code; most of them could be expressed in a single line of code or command. The command may be involved (i.e., it may use a number of parentheses or calls to functions) but can, in essence, be solved by the execution of a single command. If the problem is too complicated, feel free to break it up over two or more lines and later to collapse it into a single line.

5. Given the array A = [2 7 9 7 ; 3 1 5 6 ; 8 1 2 5], provide the command that will

a. assign the even-numbered columns of A to an array called B

b. assign the odd-numbered rows to an array called C

c. convert A into a 4-by-3 array

d. compute the reciprocal of each element of A

e. compute the square-root of each element of A

Explanation / Answer

a. B = A(:,2:2:end) b. C = A(1:2:end,:) c. c = reshape(A,4,3) or c = A' (they are different but are both 4x3) d. d = 1./A , rats(d) e. e = sqrt(A)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote