LAB Assignment-2 How To Perform Matrix Operation in OCTAVE ONLINE or MATLAB
LAB Assignment-2 How To Perform Matrix Operation in OCTAVE ONLINE or MATLAB
Matrix can be square, rectangular, row, column, upper triangular, lower triangular, identity.
Operations in Matrix: -
1. Addition of matrices in Octave online: -
Addition of matrices is simply algebraic summation of two matrices of each row/column
elements. Suppose aij is one of the element of matrix A, and bij is element of another matrix B
(it must be the same array element that was in matrix A), then sum of matrix is aij + bij. One
thing we will make sure the that order of matrices must be same.
Example of:- 2 x 2 matrix
Procedure in Octave Online/MATLAB: -
(i) Firstly, Assume two matrices A and B of same order(3 x 3). For writing matrix A at
octave online/MATLAB.
➢ type “A= [” in octave command prompt
➢ type first row of matrix A
➢ type “;”
➢ type second row of matrix A
➢ type “;”
➢ type third row of matrix A
➢ type “]”, then press “ENTER”
➢ Matrix A appear as shown below in screen shot.
(i) Firstly, assume two matrices, Matrix A of order 4 x 3 and other matrix B of 3 x 2.
Then type matrix A and B at octave command prompt in a similar way as explained
above in addition and subtraction of matrices A and B.
(ii) For multiplication of matrices A and B, Type “A*B”, then press ENTER.
(iii) Then multiplication of two matrix done and resultant matrix of order 4 x 2 obtained.
4. Determinant of matrix in Octave online: -
Determinant of matrices is only happened when the matrix is square.
(i) Firstly, assume one square matrix A of order 5 x 5 and write a matrix A in a similar
way as explained above in the addition and subtraction of two matrices.
(ii) For determinant of matrices A, Type “det”, press SPACE KEY and Type “(A)”, then
press ENTER.
(i) Firstly, assume the same square matrix A as it writes above for the determinant of
determinant of matrix. Hence it is already checked that determinant of matrix is
nonzero that means inverse of matrix will definitely obtain.
(ii) For inverse of matrix A, Type “inverse”, press SPACE KEY, and type “(A)” then
press ENTER.
(i) Firstly, assume one row matrix A of order 1 x 5 then write in octave online in similar
way as write other matrices A and B above in addition and subtraction.
(ii) For transpose of matrix A, Type “transpose”, press SPACE KEY, and type “(A)”
then press ENTER.