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

Loop Analysis If the MATLAB function LR Sum below receives the given matrix A as

ID: 3934803 • Letter: L

Question

Loop Analysis If the MATLAB function LR Sum below receives the given matrix A as input, determine what the function would return in ret. A =[1 2 3 4 5 6 7 8 9 10 11 12] Your analysis for this loop must be done by hand below-you must write-out your answers and you must verify and "desk-check" everything by hand below. As shown in lecture, you must write-out a table that contains each iteration number and the values of ii, jj, A (ii, j j ) and ret (ii) for each iteration of the nested loops. You should not use MATLAB for this problem, unless it is to check your hand-work after you've finished. function [ret] = LR Sum(A) [m, n] = size (A); ret = zeros(m, 1); for ii = l:m for jj = l:ii ret(ii) = ret(ii) + A(ii, jj); end end end

Explanation / Answer


Result:
1
11
30

ii jj A(ii,jj) ret(ii) 1 1 1 1 2 1 5 5 2 2 6 11 3 1 9 9 3 2 10 19 3 3 11 30
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