please write code on Matlab following above instructions (on the picture ) A06.3
ID: 3862279 • Letter: P
Question
please write code on Matlab following above instructions (on the picture )
Explanation / Answer
In MatLab first check a Series of Matrices are strictly diagonally dominant are not:
save as the Script in MatLab as diagdom.m
MatLab Script:
%size gives how many rows and columns in the A matrix
rowcol=size(A);
n=rowcol(1);
% count = counts the how many rows in that
% the absolute value of the diagonal element in a row is
% strictly greater than the sum of absolute value
% of the rest of the elements in that row
count=0;
for i=1:1:n
sumrow=0;
for j=1:1:n
if i~=j
sumrow=sumrow+abs(A(i,j));
end
end
if abs(A(i,i))>sumrow
count=count+1;
end
end
disp('FIRST WAY')
if count==n
disp('Matrix is strictly diagonal dominant')
else
disp('Matrix is NOT strictly diagonal dominant')
end
Result:
FIRST WAY
Matrix is NOT strictly diagonal dominant
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.