Please answer through MATLAB and show WHOLE script.
MATLAB code:
%----------------------
function result = dominant(A)
% matrix dimensions
d = size(A);
% for loop over rows
for i = 1:d
% sum of row elements except diagonal element
sum_row =0;
% for loop over columns
for j = 1:d
% adding each elements to sum variable
sum_row = sum_row+ abs(A(i,j));
end
%subratcting diagonal element
sum_row = sum_row-abs(A(i,i));
%checking dominant condition
% failed once means matrix is not diagonal dominant
if abs(A(i,i))< sum_row
result = 'false';
return;
end
end
% dominant condition not failed
result = 'true';
end
% matrix A
A = [ 3 -2 1; 1 -3 2; 1 2 6]
% result
result = dominant(A)
% matrix A
A = [ -2 1 2; 1 3 2; 1 -2 0]
% result
result = dominant(A)
%----------------------
Output:
Code snippet:
Please answer through MATLAB and show WHOLE script. 1. An n x n matrix is said...
answer 8 using matlab Using nested loops, traverse through the matrix for the following. a) Replace all elements divisible by 3 with 100. b) Replace all elements divisible by 2 with 50. c) Replace the first element of each row with 10. d) Display the all elements of the 2D matrix as a 10 array (9 elements in 1 row) 8) Write a function file that determines the maximum element of an input matrix A using nested loops and counts...
matlab( answer the question in matlab) show the full answer with comment please. W a rnction to find the largest product of adjacent number pairs in a matrix, where pair combinations can be selected the horsonal accent or vertically adjacent (but not diagonally adjacent) of numbers in a matrix are accent if they are in the same row or column and located next to each other when the 2D matrix is displayed The largest product of a pair of adjacent...
Please answer 1c, use MATLAB, and paste your entire script in your answer so that I can copy and paste to see if it works. Problem #1 400g triangle square pentagon hexagon Figure 1 For a closed geometric figure composed of straight lines (Figure 1), the interior angles in the figure must add to (n-2)(180) where n is the number of sides. Required Tasks a) Write a script that prompts the user to select from one of the following shapes:...
(1 point) The trace of a square n x n matrix A = (aii) is the sum ani + 022 + ... + ann of the entries on its main diagonal. Let V be the vector space of all 2 x 2 matrices with real entries. Let H be the set of all 2 x 2 matrices with real entries that have trace 1. Is Ha subspace of the vector space V? 1. Does H contain the zero vector of...