You are on page 1of 3

SIMULATION AND MODELING

Course Code: BCSE3061


(ETE LAB EXPERIMENT)

B-TECH

SCHOOL OF COMPUTING SCIENCE AND ENGINEERING

GALGOTIAS UNIVERSITY, GREATER NOIDA

UTTAR PRADESH

NAME: - Akshay Maan


ENROLLMENT NO: - 1713101933
ADD. NO: - 17SCSE101988
SECTION-12
EXPERIMENT-7

AIM: - Program to addition, Subtraction, Multiplication of Two Matrix.

Procedure: -

MATLAB has two different types of arithmetic operations. Matrix arithmetic


operations are defined by the rules of linear algebra. Array arithmetic
operations are carried out element by element and can be used with
multidimensional arrays. The period character (.) distinguishes the array
operations from the matrix operations. However, since the matrix and array
operations are the same for addition and subtraction, the character pairs.
+ and.- are not used.

+ Addition or unary plus. A+B adds A and B. A and B must have the same size
unless one is a scalar. A scalar can be added to a matrix of any size.
- Subtraction or unary minus. A-B subtracts B from A. A and B must have the
same size unless one is a scalar. A scalar can be subtracted from a matrix of any
size.
* Matrix multiplication. C = A*B is the linear algebraic product of the
matrices A and B.

Program: -

clc;
clear;
B = [2 2 3; 4 0 6; 8 1 5];
C = [1 1 2; 6 3 5; 1 9 1];

disp('B'); disp(B);
disp('C'); disp(C);
D = B - C; disp('D = B - C'); disp(D);
E = B + C; disp('E = B + C'); disp(E);
F= E+2; disp('F = E + 2'); disp(F);
G=B*C; disp('G = B * C'); disp(G);
H= B.*C; disp('H = B .* C'); disp(H);
Output: -

Result: -

The program is successfully executed and verified.

You might also like