code for adding two matrices: ( '+' operator is used for summing two matrices)
code for matrix subtraction: ('-' operator is used for subtraction. It is done using 2x2 matrices)
multiplying matrices: (' * 'operator is used for multiplication)
a = [ 1 2 3 ; 4 5 6 ; 7 8 9]
b= [ 1 0 0 ; 0 1 0; 0 0 1]
c = a+b
code for matrix subtraction: ('-' operator is used for subtraction. It is done using 2x2 matrices)
a = [ 2 2 ; 4 4]
b = [1 0 ; 0 0]
c = a-b
multiplying matrices: (' * 'operator is used for multiplication)
a = [ 1 2 ; 3 4 ]
b = [ 1 0 ; 0 1]
c = a*b
No comments:
Post a Comment