Bonjour, j'ai écris un 2eme programme pour calculer l'inverse d'une matrice 3*3
mais je ne suis pas sur de celui pouvez vous me dire si c'est correct
function [ com] = comatrice ( M )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
a=[M(2,2),M(2,3);M(3,2),M(3,3)]
b=[M(2,1),M(2,3);M(3,1),M(3,3)]
c=[M(2,1),M(2,2);M(3,1),M(3,2)]
d=[M(1,2),M(1,3);M(3,2),M(3,3)]
e=[M(1,1),M(1,3);M(3,1),M(3,3)]
f=[M(1,1),M(1,2);M(3,1),M(3,2)]
g=[M(1,2),M(1,3);M(2,2),M(2,3)]
h=[M(1,1),M(1,3);M(2,1),M(2,3)]
i=[M(1,1),M(1,2);M(2,1),M(2,2)]
comatrice=[deter2(a),-deter2(b),deter2(c);-deter2(d),deter2(e),-deter2(f);deter2(g),-deter2(h),deter2(i)]
end
function [ det3 ] = deter3 ( M )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
a= [M(2,2), M(2,3); M(3,2),M(3,3)]
b=[ M(2,1), M(2,3); M(3,1), M(3,3)]
c=[ M(2,1), M(2,2); M(3,1),M(3,2)]
det3=(M(1,1)*deter2(a))-(M(1,2)*deter2(b))+(M(1,3)*det er2(c))
function [ det2] =deter2(M )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
det2=M(1,1)*M(2,2)-M(1,2)*M(2,1)
end
fonction [inverse]=inv(M)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
inv=1/deter3 *comatrice'
end
j'ai voulu commencé par le calcule de la comatrice.
-----