Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
control-1

# control-1

Ratings: (0)|Views: 3 |Likes:

### Availability:

See more
See less

05/29/2014

pdf

text

original

CONTROL ENGINEERING-I
Lab-1 Dated: 24-10-2007
1. What is MATLAB:

The name Matlab is short for the MATrix LABoratory. It is commercial software package whose main function is to perform calculations on matrices, row vectors, and column vectors. It is widely used in both industry and academic institutions. It possesses many of the features of the High Level, numerically oriented programming language, but in addition has a large collection of built-in functions for performing matrix and vector operations in a way that is very simple for the user.

In addition to functions for performing the usual computations from linear algebra (e.g., inverse, transpose, determinants etc.) Matlab has collection oftoolboxes of more specialized functions for computations in specific areas of science and engineering including Control system Toolbox.

2. Entering and Quitting MATLAB.

Start windows and double click on the MATLAB icon (if it is installed!). A command window will appear. You can write your programs directly on the window or you may open a new file fromfile menu, which appears on top of the command window.

3. Creating and Manipulating Matrices and Vectors.

Matlab works on matrices and vectors that may be real or complex. Variables do not have to be declared (as in C-language). Computations are performed using double- precision arithmetic, and the results can be displayed in a variety of different formats. Let us enter a row matrix into the Matlab workspace. Type in:

\u00bb v=[2 4 7 5]
and pressing enter key will result in echo back to you:
v =
2
4
7
5
this creates a variable v whose current value is a row vector with four elements as
shown. To suppress the echo one uses semicolon following the command line. Thus
\u00bb W=[1 3 8 9];
creates another row vector W, but does not echo. To check that W has appeared in the
Matlab workspace, type
\u00bb who
which will display all the variables in the Matlab workspace as:
W
v
and to check the value of W simply type:
\u00bb W
and press enter key,
W =
1
3
8
9
Note that Matlab is case sensitive.
EXERCISE-1: investigate the effect of the following commands:
(i)
v(2)
(ii)
W(4)
(iii)
sum=v+W.
(iv)
diff=v-W
(v)
vW=[v W]
(vi) vW(2:6)
(vi)
v\u2019
column vectors can be typed directly in one of two ways, for example, to enter the
column vector
\ue004\ue004\ue004\ue004\ue005\ue003
\ue001\ue001\ue001\ue001\ue002\ue000
=
00
11
Z
you can type
\u00bb Z=[1;1;0;0]or
\u00bb Z=[1100]
both will result in:
Z =
1100
EXERCISE-2: investigate the effects of following commands:
(i)
Z\u2019
(ii)
Z*v
(iii)
Z\u2019*v\u2019
(iv)
[v;W]
(v)

[Z;v\u2019]
it creates a new matrix of single column combining the column vector Z and
transpose of row matrix v.
(vi)

Z+v\u2019
it simply adds the column vector Z with transpose of row vector v.
These are various ways of entering matrices. For example, to enter the matrix
\ue004\ue005\ue003
\ue001\ue002\ue000
=
4
3
2
1
M
the most obvious ways are to type
\u00bb M=[1 2;3 4] or
\u00bb M=[1 2 3 4]
but there are more perverse ways such as:
\u00bb M=[[1 3]'[2 4]']
EXERCISE-3: investigate the effect of the following commands:
(i)

N=inv(M)
this creates a new matrix N whivh is a inverse of matrix M.
(ii)

M*N
it simply multiply M with N.
(iii)

det(M)
it finds the determinant of matrix M.
(iv)

I=eye(2)
this display the identity matrix of order 2-by-2.