0% found this document useful (0 votes)
258 views2 pages

Matriks Matlab

The document defines code to perform matrix operations in MATLAB. It defines 3x3 matrices A and B, prompts the user to input values for the elements, and calculates the product of the two matrices. It then calculates the determinants of A and B. Finally, it displays the cofactors of matrix A.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
258 views2 pages

Matriks Matlab

The document defines code to perform matrix operations in MATLAB. It defines 3x3 matrices A and B, prompts the user to input values for the elements, and calculates the product of the two matrices. It then calculates the determinants of A and B. Finally, it displays the cofactors of matrix A.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

%matriks

clear all;
clc;
%matrik A
disp('Silahkan masukkan nilai pada Matrik A')
a11=input
a12=input
a13=input
a21=input
a22=input
a23=input
a31=input
a32=input
a33=input

('nilai
('nilai
('nilai
('nilai
('nilai
('nilai
('nilai
('nilai
('nilai

a11 =');
a12=');
a13=');
a21=');
a22=');
a23=');
a31=');
a32=');
a33=');

A=[a11 a12 a13;a21 a22 a23;a31 a32 a33]

%matrik B
disp('Silahkan masukkan nilai elemen pada Matrik B')
b11=input
b12=input
b13=input
b21=input
b22=input
b23=input
b31=input
b32=input
b33=input

('nilai
('nilai
('nilai
('nilai
('nilai
('nilai
('nilai
('nilai
('nilai

b11 =');
b12=');
b13=');
b21=');
b22=');
b23=');
b31=');
b32=');
b33=');

B=[b11 b12 b13; b21 b22 b23; b31 b32 b33]


disp('-------------------------------------------------------------------------'
)
disp('-------------------------------------------------------------------------'
)
disp('
')
%Perkalian Matriks A & B
disp('Perkalian antara matriks A & B')
perkalian=A*B
disp('-------------------------------------------------------------------------'
)
disp('-------------------------------------------------------------------------'
)
disp('
')

%Determinan matriks
disp('Determinan Matris A')
Da11=a22*a33-a23*a32;
Da12=a21*a33-a23*a31;

Da13=a21*a32-a22*a31;
DeterminanA=a11*Da11-a12*Da12+a13*Da13
disp('
disp('

')
')

disp('Determinan Matris B')


Db11=b22*b33-b23*b32;
Db12=b21*b33-b23*b31;
Db13=b21*b32-b22*b31;
DeterminanB=b11*Db11-b12*Db12+b13*Db13
disp('-------------------------------------------------------------------------'
)
disp('-------------------------------------------------------------------------'
)
disp('
')

%Kofaktor
disp('Kofaktor matriks A')
Ka11=Da11
Ka12=Da12
Ka13=Da13
Ka21=a12*a33-a13*a32
Ka22=a11*a33-a13*a31
Ka23=a11*a32-a12*a31
Ka31=a12*a23-a13*a22
Ka32=a11*a23-a13*a21
Ka33=a11*a22-a12*a21

You might also like