0% found this document useful (0 votes)
46 views

Arrays, Multidimensional Arrays, Operations

The document discusses array representation and operations in MATLAB. It explains that arrays can store data and are indexed with integers, unlike tables which can vary in size. It also defines scalars, row vectors, and column vectors. The document then covers one-dimensional and two-dimensional array representation. It provides examples of assigning values to variables A and B, and mathematical operations that can be performed on arrays like addition, subtraction, multiplication, and transposition. Multi-dimensional arrays and operations on matrices are also demonstrated. Finally, it discusses array indexing, appending matrices, reshaping matrices, and deleting matrices in MATLAB.

Uploaded by

apecevsb
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Arrays, Multidimensional Arrays, Operations

The document discusses array representation and operations in MATLAB. It explains that arrays can store data and are indexed with integers, unlike tables which can vary in size. It also defines scalars, row vectors, and column vectors. The document then covers one-dimensional and two-dimensional array representation. It provides examples of assigning values to variables A and B, and mathematical operations that can be performed on arrays like addition, subtraction, multiplication, and transposition. Multi-dimensional arrays and operations on matrices are also demonstrated. Finally, it discusses array indexing, appending matrices, reshaping matrices, and deleting matrices in MATLAB.

Uploaded by

apecevsb
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Array Represenation:

% Assigning array elements row wise to


a variable A

% Assigning array elements to a


variable A using ( : ) Operator

% Assigning array elements to a


variable A using ( : ) Operator with step
increment of 2

%Arrange array elements in to column


vector

% Assigning array elements column


wise to a variable A

Expt.No.

ARRAYS, MULTIDIMENTIONAL ARRAYS AND OPERATIONS

Date:
Aim:
To understand the basic logic behind Matrices and its Operations using Matlab tool.
Softwares Required:
Matlab R2015a
Hardware Required:

% Assigning array
elements row wise to a
variable A

A personnel Computer.
Procedures:
1. Open matlab File.
2. Type the program in the editor
3. Save the file with .m
the program.
4. Verify the output in the

% Assigning array
elements row wise to a
variable B
% Adding elements in A
with B

window.
Extension and run
command Window.

Theory:
Arrays are container objects for
contrast to tables, the indices must be
integers. While tables may grow in
the number of entries in an array
fixed.
A Scalar is a (1 x 1) Matrix
element only. A column vector is an
has m number of rows but single
Row vector is an (1 x n) matrix that
columns but single row only.
A 1-dimensional array is printed as a
index corresponds to the column
A 2-dimensional array is printed as a
index corresponds to the row number
index corresponds to the column

% Subtracting elements
in A from B

% Multiplying elements
in A with B (Element by
Element)

% Dividing elements in A
with B (Element by
Element)

%Taking Transpose of B
Array Operations:

% Multiplying elements
in A with C

storing data. In
sequences
of
size dynamically,
created by array is
containing single
(m x 1) matrix that
Column only. A
has n number of
row vector.
number.

The

matrix. The first


and the second
number.

Multi Dimensional Array Representation and


Operation:

%Assigning matrix elements to


Variable A

%Assigning matrix elements to


Variable B

%Adding matrix elements of A with


B

%Subtracting matrix elements of A


from B
%Multiplying matrix elements of A
with B

%Multiplying element by element


matrix elements of A with B

%Dividing element by element


matrix elements of A with B

Array Indexing:

Appending Matrices:

Appending Matrices using cat Function:

Reshaping Matrices:

Deleting Matrices:

Result:

You might also like