Using nested loops, write a MATLAB program that outputs the sum, [A] + [B], of t
ID: 3814736 • Letter: U
Question
Using nested loops, write a MATLAB program that outputs the sum, [A] + [B], of two equally sized matrices, [A] and [B]. Test and run your program for the two following matrices, [A] and [B]. [A] = [0 5 -3 1 - 7 9 5 5 12] and [B] = [14 2 5 1 7 3 1 3 5] Using nested loops, write a MATLAB function that outputs the numeric value of the difference of two equally sized matrices, [A] and [B]. Test and run your program for the two following matrices, [A] and [B]. [A] = [12 13 10 7 9 13 1 8 12] and [B] = [-14 10 5 -7 7 4 2 0 -9]Explanation / Answer
y=input('enter row size');
x=input('enter coloum size');
for i=1:x
for j=1:y
a(i,j)=input('enter value a array');
end
end
for i=1:x
for j=1:y
b(i,j)=input('enter value b array');
end
end
for i=1:x
for j=1:y
c(i,j)=a(i,j)+b(i,j);
end
end
display(c);
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.