Borrar filtros
Borrar filtros

Inverse matrix with for loop, dimensions are wrong I don't know how to fix it

1 visualización (últimos 30 días)
C=[-2,3;
6,5]
[m,n]=size(C)
z=zeros(m,n)
%cofactor
c1= C(2,2)
c2 = -C(1,2)
c3 = -C(2,1)
c4 = C(1,1)
%cofactor matrix
c = [c1,c3;
c2,c4]
for i= 1:m
for j= 1:n
for k=1/det(C(i,j))
for h= transpose(c)
z(i,j)= k*h
end
end
end
end
  1 comentario
Jan
Jan el 24 de Dic. de 2020
Before the readers can fix your code, they need to know, what you try to do. "Inverse matrix with foor loop" is not clear enough.
det(x) is x, if x is a scalar. So "for k=1/det(C(i,j))" is the same as "k = 1 / C(i,j)".
What is the purpose of "for h= transpose(c)"?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by