Saturday, 16 November 2013

Study and Implementation of Matrix Manipulation and Array Handling.

AIM: Study and Implementation of Matrix Manipulation and Array Handling. 
The fundamental unit of data in any MATLAB program is the array. An array is a collection of data values organized into rows and columns and known by a single name. Individual data values within an array are accessed by including the name of the array followed by subscripts in parentheses that identify the row and column of the particular value. Even scalars are treated as arrays by MATLAB—they are simply arrays with only one row and one column. Arrays can be classified as either vectors or matrices.
The term “vector” is usually used to describe an array with only one dimension, while the term “matrix” is usually used to describe an array with two or more dimensions. In this text, we will use the term “vector” when discussing one-dimensional arrays, and the term “matrix” when discussing arrays with two or more dimensions. If a particular discussion applies to both types of arrays, we will use the generic term “array.” The size of an array is specified by the number of rows and the number of columns in the array, with the number of rows mentioned first. 

The total number of elements in the array will be the product of the number of rows and the number of columns. For example, the sizes of the following arrays are.

MATLAB variable names must begin with a letter followed by any combination of letters, numbers, and the underscore (_) character. Only the first 63 characters are significant; if more than 63 are used, the remaining characters will be ignored. If two variables are declared with names that differ only in the 64th character, MATLAB will treat them as the same variable. MATLAB will issue a warning if it has to truncate a long variable name to 63 characters.

1. Take two matrixes for Athematic Operations using ‘input’ Command.
2. Do Addition, Subtraction, Multiplication and Division.

% Program for Matrix Manipulation
a=input('Enter 1st matrix = ');
b=input('Enter 2nd Matrix = ');

% Addition of two matrix
disp('Addition of Matrix is');c

% Substraction of two matrix
disp('Subtraction of Matrix is');d

% Multiplication of two matrix
disp('Multiplication of Matrix is');e

% Division of two matrix
disp('Division of Matrix is');f

Enter 1st matrix = [1 2 3;3 4 5;2 3 4]
Enter 2nd Matrix = [4 5 6;3 4 5;2 3 4]
Addition of Matrix is
c =
     5     7     9
     6     8    10
     4     6     8

Subtraction of Matrix is
d =
    -3    -3    -3
     0     0     0
     0     0     0
Multiplication of Matrix is
e =
     4    10    18
     9    16    25
     4     9    16
Division of Matrix is
f =
    0.2500    0.4000    0.5000
    1.0000    1.0000    1.0000
    1.0000    1.0000    1.0000

No comments:

Post a Comment