Given the matrices A and B below A 3 5 7 8 2 4 3 6 1 B 3 3

Given the matrices A and B below: A = [3 5 7 -8 2 4 3 -6 1] B = [3 -3 5 4 -8 4 6 1 -1] Answer the following questions using MATLAB. You may have to perform several operations for some of the questions. Show your results as logical values (i.e. 1 for true and 0 for false). Which elements of A are equal to the corresponding elements of B? Which elements of A are greater than the corresponding elements of B? The absolute values of which elements of A are greater than or equal to the absolute values of the corresponding elements of B? Which elements of A are not equal to the (2, 2) element of B? Is the sum of all elements of A less than the sum of all elements of B?

Solution

A = [3 5 7;-8 2 4;3 -6 1];
B = [3 -3 5;4 -8 4;6 1 -1];

A==B;
%{
Result is
1 0 0
0 0 1
0 0 0
%}

A>B;
%{
Result is
0 1 1
0 1 0
0 0 1
%}

abs(A)>=abs(B);
%{
Result is
1 1 1
1 0 1
0 1 1
%}

A != B(2,2);
%{
Result is
1 1 1
0 1 1
1 1 1
%}

sum(A(:))<sum(B(:))
ans = 0

 Given the matrices A and B below: A = [3 5 7 -8 2 4 3 -6 1] B = [3 -3 5 4 -8 4 6 1 -1] Answer the following questions using MATLAB. You may have to perform sev

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site