SS RECORD
SS RECORD
SOFTWARE REQURIED:
1. MATLAB version 7.0
2. PC/laptop.
THEORY:-
MATLAB, which stands for Matrix Laboratory, is a state-of-the-art mathematical software
package, which is used extensively in both academia and industry. It is an interactive program
for numerical computation and data visualization, which along with its programming
capabilities provides a very useful tool for almost all areas of science and engineering. Unlike
other mathematical packages, such as MAPLE or MATHEMATICA, MATLAB cannot
perform symbolic manipulations without the use of additional Toolboxes. It remains however,
one of the leading software packages for numerical computation. As you might guess from its
name, MATLAB deals mainly with matrices. A scalar is a 1-by-1 matrix and a row vector of
length say 5, is a 1-by-5 matrix. One of the many advantages of MATLAB is the natural
notation used. It looks a lot like the notation that you encounter in a linear algebra. This
makes the use of the program especially easy and it is what makes MATLAB a natural choice
for numerical computations. The purpose of this experiment is to familiarize MATLAB, by
introducing the basic features and commands of the program.
Built in Functions:
1. Scalar Functions:
Certain MATLAB functions are essentially used on scalars, but operate element-wise when
applied to a matrix (or vector). They are summarized below.
1. sin-trigonometric sine
2. cos -trigonometric cosine
3. tan- trigonometric tangent
4. asin-trigonometric inverse sine (arcsine)
5. acos-trigonometric inverse cosine (arccosine)
6. atan-trigonometric inverse tangent (arctangent)
7. exp-exponential
8. log-natural logarithm
9. abs-absolute value
10. sqrt -square root
11. rem- remainder
12. round -round towards nearest integer
13. floor-round towards negative infinity
14. ceil-round towards positive infinity
2. Vector Functions:
Other MATLAB functions operate essentially on vectors returning a scalar value. Some of
these functions are given below.
1. max largest component: get the row in which the maximum element lies
2. min- smallest component
3. length-length of a vector
4. sort-sort in ascending order
5. sum-sum of elements
6. prod- product of elements
7. median-median value
8. meanmean value std standard deviation
3. Matrix Functions:
Much of MATLAB's power comes from its matrix functions. These can be further separated
into two sub-categories.
The first one consists of convenient matrix building functions, some of which are given
below.
1. eye -identity matrix
2. zeros- matrix of zeros
3. ones- matrix of ones
4. diag -extract diagonal of a matrix or create diagonal matrices
5. triu- upper triangular part of a matrix
6. tril - lower triangular part of a matrix
7. rand -randomly generated matrix
PROCEDURE:-
Open MATLAB
Open new M-file
Type the program Save in current directory
Compile and Run the program
For the output see command window\ Figure window
PROGRAM:-
clc;
close all;
clear all;
[1 2 -9;2- 1 2; 3 -4 3];
disp('The matrix a ');
b[1 2 3; 4 5 6; 7 8 9];
disp(The matrix b= ');
% to find sum of a and b
c=a+b
disp('The sum of a and b is ');
c
% to find difference of a and b
d=a-b
disp('The difference of a and b is ');
d
%to find multiplication of a and b
e=a * b
disp('The product of a and b is ');
e
% to find diagonals of a and b
f=diag(a)
g=diag(b)
disp('The diagonals of a and b are');
f
g
% to find the transpose of a and b
h=transpose(a)
disp('The transpose of a is')
h
i=transpose(b)
disp('The transpose of b is')
i
OUTPUT:
RESULT:-
Finding addition, subtraction, multiplication,diagonalization,transpose on matrices using MATLAB
was Successfully completed.