0% found this document useful (0 votes)
87 views10 pages

LAB Assignment-2 How To Perform Matrix Operation in OCTAVE ONLINE or MATLAB

- Matrix operations like addition, subtraction, multiplication, determinant, inverse, and transpose can be performed in Octave online. - Matrices of different sizes can be defined and operated on depending on the rules of the specific operation. - The basic steps are to define the matrices, specify the operation, and press enter to obtain the result.

Uploaded by

Dinesh Jangra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views10 pages

LAB Assignment-2 How To Perform Matrix Operation in OCTAVE ONLINE or MATLAB

- Matrix operations like addition, subtraction, multiplication, determinant, inverse, and transpose can be performed in Octave online. - Matrices of different sizes can be defined and operated on depending on the rules of the specific operation. - The basic steps are to define the matrices, specify the operation, and press enter to obtain the result.

Uploaded by

Dinesh Jangra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Aim: - How to perform matrix operations in Octave online.

Theory: - MATLAB stands for Matrix Laboratory. It is multi-paradigm programming


language and numeric computing environment developed by MathWorks. MATLAB allows
matrix manipulations, plotting of functions and data, implementation of algorithms, creation
of user interfaces, and interfacing with programs written in other language. Octave online is
other alternative of MATLAB for matrix operations.
Matrix is set of numbers arranged in rows and columns so as to form a rectangular array.
Matrices used to find out the solution of linear equations of ‘n’ no. of variables. It is also used
in structure analysis as flexibility and stiffness matrices to find out the unknown reactions in
the indeterminate structures.
Matrix is arranged as M rows and N columns, expressed as

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.

(ii) Matrix B is also writing in a similar way as other Matrix A writes.

(iii) For the summation of Matrices A and B


➢ type “A+B ” in octave command prompt
➢ Press ENTER
➢ Then Summation of two Matrices A and B obtained.

2. Subtraction of matrices in Octave online: -


Subtraction of matrices is simply algebraic subtraction 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.
(ii) Matrix B is also writing in a similar way as other Matrix A writes.

(iii) For the subtraction of Matrices A and B


➢ type “A-B” in octave command prompt
➢ Press ENTER
➢ Then Subtraction of two Matrices A and B obtained.
3. Multiplication of matrices in Octave online: -
Multiplication of matrices is only happened when no. of columns of matrix A is equal
to the no. of rows of other matrix. If matrix A is order m x n and matrix B of order n x
p, then multiplication of two matrix A and B of order n x n.
Example: -

Procedure in Octave online/MATLAB: -

(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.

Procedure in Octave online/MATLAB: -

(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.

(iii) Then determinant of matrix A done and it is non zero.

5. Inverse of matrices in Octave online: -


Inverse of matrices will only be obtained when the matrix is square and determinant
of matrix is non-zero.

Procedure in Octave online/MATLAB: -

(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.

(iii) Then required inverse of matrix A obtained.

6. Transpose of matrix in Octave online: -


The transpose of a matrix is obtained by changing the rows into columns and columns
into rows for a given matrix.
Procedure in Octave online/MATLAB: -

(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.

(iii) Then required inverse of matrix A obtained.

You might also like