Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Zad.1
- A=[2,3,1; 4,1,2; 3,5,1];
- detA=A(1,1)*A(2,2)*A(3,3)+A(1,2)*A(2,3)*A(3,1)+A(1,3)*A(2,1)*A(3,2)-A(1,3)*A(2,2)*A(3,1)- A(1,1)*A(2,3)*A(3,2)-A(1,2)*A(2,1)*A(3,3);
- disp("Wyznacznik Macierzy A:"); disp(detA); disp("Sprawdzenie"); disp(det(A));
- %Zad.2
- P=[-3,-2,3; 1,-1,5; -8,-4,4];
- detP=P(1,1)*P(2,2)*P(3,3)+P(1,2)*P(2,3)*P(3,1)+P(1,3)*P(2,1)*P(3,2)-P(1,3)*P(2,2)*P(3,1)- P(1,1)*P(2,3)*P(3,2)-P(1,2)*P(2,1)*P(3,3);
- if detP!=0
- D(1,1)=(P(2,2)*P(3,3)-P(3,2)*P(2,3)); D(1,2)=(P(2,1)*P(3,3)-P(2,3)*P(3,1))*(-1); D(1,3)=(P(2,1)*P(3,2)-P(1,2)*P(3,1)); D(2,1)=(P(1,2)*P(3,3)-P(1,3)*P(3,1))*(-1); D(2,2)=(P(1,1)*P(3,3)-P(1,3)*P(3,1)); D(2,3)=(P(1,1)*P(3,3)-P(1,2)*P(3,1))*(-1); D(3,1)=(P(1,2)*P(2,3)-P(1,3)*P(2,2)); D(3,2)=(P(1,1)*P(2,3)-P(1,3)*P(2,1))*(-1); D(3,3)=(P(1,1)*P(2,2)-P(1,2)*P(2,1));
- DT=zeros(3,3); for i=1:3
- for j=1:3
- DT(j,i)=D(i,j); end
- end P_odw=(1/detP)*DT;
- disp("Macierz odwrotna:"); disp(P_odw); disp("Sprawdzenie") disp(inv(P));
- else
- disp("Macierz nie posiada macierzy odwrotnej");
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement