Regular matrix and non-singular matrix

18 Ansichten (letzte 30 Tage)
Noa  Yelin
Noa Yelin am 20 Okt. 2020
Kommentiert: Steven Lord am 20 Okt. 2020
Hey
I need to write a function that the user enters a matrix, and the function returns "1" if the matrix is reversible(regular) and "0" if it's not.
I wrote this function-
function x=irr_mat(A)
if isequal(A,zeros(n))
x=0;
else
if size(A,1)==size(A,2)
x=1;
else
x=0;
end
end
end
n is the array of the matrix.
and I got this note-
Error in irr_mat (line 3)
if isequal(A,zeros(n))
Error in Untitled5 (line 3)
irr_mat(A)
any help?
  14 Kommentare
Noa  Yelin
Noa Yelin am 20 Okt. 2020
i dont get A 4X4. I got -
n =
4 4
ans =
1
I need to get matrix A with 4 rows and 4 columns
Steven Lord
Steven Lord am 20 Okt. 2020
What specifically do you mean by "reversible(regular)"? Which of the following count as reversible / regular and why do they count or not count?
A1 = 1
A2 = 42
A3 = 99
A4 = 12321
A5 = [1 2; 3 4]
A6 = [1 23; 23 1]
A7 = [98 89; 764 467]
A8 = [1 2 3 4; 5 6 7 8; 9 10 10 9; 8 7 6 5; 4 3 2 1]

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by