clear all A=[1 2;3 4] %define 2 by 2 matrix B=[5 6;7 8] C=A+B %addition D=A-B %subtraction Ctranspose=C' %transpose switch the row and column column=[1;2;3;4] %column vector row=column' %row vector is transpose of column vector E=A*B %matrix multiplication F=[5;6] H=A\F %this gives the solution of A*H=F A*H %verify if it equals F sin(A) %matrix function I=A.*B %this multiplys each entries of matrices J=[1 2;3 4;5 6] K=[7;8;10] L=J\K %equations more than variables, gives linear regression solution J*L %not equals to K, but close A(1,1) %returns the entry of matrix A at (1,1)