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

MATLAB Code Please. I want a 50 times 50 matrix called A where: The value of the

ID: 3876649 • Letter: M

Question

MATLAB Code Please.

I want a 50 times 50 matrix called A where: The value of the elements in the first row is the number of the column they are in. The value of the elements in the first column is the number of the row they are in. The other elements are equal to the difference of the element above them minus the element to the left. What is the value of the A(17, 13) element? As a check, this is what the matrix would look like as a 5 times 5 matrix: A = [1 2 3 4 5 2 0 -3 -7 -12 3 3 6 13 25 4 1 -5 -18 -43 5 4 9 27 70]

Explanation / Answer

% initializing with zeros
A = zeros(50);

% setting values in first coulumn
for i = 1:50
A(i, 1) = i;
end

% setting values in first row
for i = 1:50
A(1, i) = i;
end

% main logic is here which does math
for i = 2:50
for j = 2:50
A(i,j) = A(i-1,j)-A(i,j-1);
end
end

% printing output
disp(A(17,13))

Output : 45662127