Lab Sheet 1
Lab Sheet 1
NAME :
MATRIC / STUDENT NO :
DATE :
LECTURER : DR. MUHAMAD SYAZMIE BIN SEPEEH
Name
Student ID Batch
Module Code BEE1081 Module Title Engineering Software and Applications
Year 1 Semester Session
No. Lab 1
Title Array and Matrices
AIM:
To write a MATLAB program to form an array and matrix.
THEORY:
The term matrix is used in the MATLAB environment to refer to a variable that contains real or
complex values arranged in a two-dimensional array. In general, an array is a vector, matrix, or
higher-dimensional grid of numbers. In MATLAB, all arrays are rectangular, meaning that the
component vectors along any dimension are of the same length. Linear algebra is concerned with
mathematical operations defined on matrices.
PROCEDURE:
1. Open MATLAB.
2. Type the program listed below in the command window.
3. Compile and run the program.
4. Verify the output in the command window.
Page 2 of 4
FACULTY OF ENGINEERING AND BUILT
ENVIRONMENT
Program 1
A = input (‘Enter values’);
B = input (‘Enter different values’);
C = A + B;
Display (C);
Program 2
A = input (‘Enter values of one dimensional array’);
B = input (‘Enter different values of one dimensional array’’);
C = A .* B;
Display (C);
Program 3
A = input (‘Enter values of one dimensional array’);
B = input (‘Enter different values of one dimensional array’’);
C = A - B;
Display (C);
Program 4
A = input (‘Enter values of two dimensional array’);
B = input (‘Enter different values of two dimensional array’’);
C = A - B;
Display (C);
Page 3 of 4
FACULTY OF ENGINEERING AND BUILT
ENVIRONMENT
Program 5
A = input (‘Enter values of two dimensional array’);
B = input (‘Enter different values of two dimensional array’’);
C = A + B;
Display (C);
Program 6
A = input (‘Enter values of three dimensional array’);
B = input (‘Enter different values of three dimensional array’’);
C = A .* B;
Display (C);
Page 4 of 4