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 endExplanation / Answer
Result:
1
11
30
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.