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: 3804617 • 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.

20:

s=20;

f=20;

B=reshape(round((f-s)*rand(1,20)+s),4,5)

c. Compute the average X of all the elements of the matrix C=A*B.

d. Find the largest element in the 2nd row of matrix C.

e. Find the (row,column) coordinate of the smallest element in the matrix C.

Explanation / Answer

c)

s= -20;
f=20;
B=reshape(round((f-s)*rand(1,20)+s),4,5)
mean(mean(B)

d)

s= -20;
f=20;
B=reshape(round((f-s)*rand(1,20)+s),4,5)
max(B(2,:))

e)

s= -20;
f=20;
B=reshape(round((f-s)*rand(1,20)+s),4,5)
mi = 1000
mr =0
mc =0
for r = 1 : 4
for c= 1 : 5
if (B(r,c) < mi)
min = B(r,c)
mc =c;
mr= r;
end;
end;
end;

mc
mr

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