Anda di halaman 1dari 4

Techno Main Saltlake

Department of Electrical Engineering

EXPERIMENT # Introduction to MATLAB

TITLE
Familiarization with and Tutorial on MATLAB Package Software.

OBJECTIVE
1. To know what it is.
2. How to invoke and quit the system.
3. Basics of programming.
4. Different Commands.

FAMILARISATION
Matlab is a commercial package and stands for "Matrix Laboratory" which operates as an
interactive programming environment.
Matlab is a tool for doing numerical computations with matrices and vectors. It can also display
information graphically. The best way to learn what Matlab can do is to work through some
examples at the computer.
To start MATLAB on Windows double click MATLAB shortcut icon on the desk-top or click
STARTclick Program click Matlab I When run MATLAB is run under the window system,
whether started from the menu or a system prompt, a small MATLAB logo window will pop up
while the program is loading and disappear when MATLAB is ready to use.
Matlab has many types of matrices which are built into the system, i.e., rand, zreos, ones, eye
etc.
MATLAB is also a programming language. By creating a file with the extension .m programs
can be easily written and run. If to create a program file myfile.m in the MATLAB language, then
to make the command myfile from MATLAB and it will run like any other MATLAB function.
Some MATLAB function descriptions
zeros - Zeros matrix.
ones - Ones matrix.
eye - Identity matrix.
rand - Uniformly distributed random numbers.
Ans - Most recent answer.
pi - 3.1415926535897....
i, j - Imaginary unit.
inf - Infinity.
sin - Sine.

Electric Circuit Theory Laboratory (PC – EE 391)


Techno Main Saltlake
Department of Electrical Engineering

sinh - Hyperbolic sine.


asin - Inverse sine.
asinh - Inverse hyperbolic sine.
cos - Cosine.
cosh - Hyperbolic cosine.
acos - Inverse cosine.
acosh - Inverse hyperbolic cosine.
tan - Tangent.
tanh - Hyperbolic tangent.
atan - Inverse tangent.
atanh - Inverse hyperbolic tangent.
exp - Exponential.
log - Natural logarithm.
log10 - Common logarithm.
sqrt - Square root.
abs - Absolute value.
angle - Phase angle.
conj - Complex conjugate.
imag - Complex imaginary part.
real - Complex real part.
norm - Matrix or vector norm.
rank - Number of linearly independent rows or columns.
det - Determinant.
trace - Sum of diagonal elements.
plot - Linear plot.
stem - Discrete plot.
loglog - Log-log scale plot.
semilogx - Semi-log scale plot.
semilogy - Semi-log scale plot.
title - Graph title.
xlabel - X-axis label.
ylabel - Y-axis label.
text - Text annotation.
grid - Grid lines.

STUDY ON COMPUTATION OF MATRICES


>> a= [1 2 3; 4 5 6; 6 8 9]
a=
1 2 3
4 5 6
6 8 9

>> inv (a) [Inverse of Matrices]


ans =
-1.0000 2.0000 -1.0000
0 -3.0000 2.0000
0.6667 1.3333 -1.0000

Electric Circuit Theory Laboratory (PC – EE 391)


Techno Main Saltlake
Department of Electrical Engineering

>> a' [transpose]


ans =
1 4 6
2 5 8
3 6 9

>> rank (a)


ans =
3

>> trace (a)


ans =
15

>> det (a) [Value of Determinant]


ans =
3

>> max (a)


ans =
6 8 9

>> min(a)
ans =
1 2 3

>> mean (a)


ans =
3.6667 5.0000 6.0000

>> b=[2 6 8;2 5 9;1 7 4]


b=
2 6 8
2 5 9
1 7 4

>> b=[r; b] [Adding rows (add before)]


b=
8 9 7
2 6 8
2 5 9
1 7 4

>> b=[2 6 8;2 5 9;1 7 4]


b=
2 6 8
2 5 9
1 7 4

Electric Circuit Theory Laboratory (PC – EE 391)


Techno Main Saltlake
Department of Electrical Engineering

>> r= [8; 9; 7]; [Adding columns (add before)]

>> c= [b r]
c=
2 6 8 8
2 5 9 9
1 7 4 7

>> a*b [Multiplication]


ans =
9 37 38
24 91 101
37 139 156

>> a+b [Addition]


ans =
3 8 11
6 10 15
7 15 13

>> a-b [substraction]


ans =
-1 -4 -5
2 0 -3
5 1 5

>> a.*b [element wise multiplication]


ans =
2 12 24
8 25 54
6 56 36

Electric Circuit Theory Laboratory (PC – EE 391)

Anda mungkin juga menyukai