Vous êtes sur la page 1sur 5

Oct15 / Feb16 - CONTROL SYSTEMS I - LAB 1

Introduction to Matlab Control Toolbox


1

Objective

The main objectives of this practice are:


To provide the student the fundamentals of MATLAB as well as to explain its
usage and recommendations of programming.
To practice the previous control knowledge solving some elemental problems
related with systems dynamics.

Introduction

The MATLAB (Matrix Laboratory) environment is an interactive software oriented


to carry out technical and scientific computations. This language is very easy to
use and powerful when dealing with matrices. The graphical visualization utilities
are impressive and flexible. MATLAB has outstanding merits in scientific computation and graphical visualization, compared with other software packages. MATLAB
has now become the most used software in the field of control systems analysis
and design, among other engineering and non-engineering areas. The MATLAB is
composed by numerous toolboxes and we will be focusing in Control Toolbox.
In the url http://www.mathworks.com, it can be found all information about
Matlab, from the point of view of product, as well as tutorials and help for all
modules that comprise it.

Exercises

Exercise 1. Operation between matrices. Considering the matrices

1 2 4
A = 7 8 9
21 6 4

2 2 4
B = 7 3 5
21 6 7
Compute the following operations indicating the used commands:
Sum of two first columns of A
1

Sum of two first columns of B


Square of matrix A
Square of the components of matrix B Inverse of matrix A
Pseudoinverse of matrix A
Product of matrices A and B
Product of every component of matrices A and B (product component to
component)
Which is the dimension of A?
Exercise 2. Trigonometric Matlab functions. Indicate the obtained value
after carrying out the following operations using the suitable commands.
cos(30 )
sin(30 )
cos2 (30 ) + sin3 (40 )
tan2 (2) + cot3 (20 )
Exercise 3. Division between matrices. Considering the previous matrices
A and B. By the following command, what operations are taken out? Which are
the results?
A/B
A\B
Exercise 4. Matlab operations. By the following commands, what operations
are taken out? (Compute these operations with the previous matrix A and matrix
B).
det(A)
A
diag(A)
triu(A)
tril(A)
size(A)
2

Exercise 5. Visualizing and erasing variables. Write the Matlab commands that: (a) show the variables of the workspace, (b) test the dimension and
type of variable, (c) erase a variable, (d) erase all the variables, (e) close all the
figures.
Exercise 6. Computing matrices. Compute: (a) a matrix of zeros with
3 rows and 4 columns, (b) an identity matrix with 4 rows and 3 columns, (c) an
identity matrix 3x3. NOTE: Use the commands: zeros, ones, eye.
Exercise 7. Graphics. Plot the curves y = x.sin(x), y = x, respect the axis x
in the interval [0, 1]. Show the graphics with different color or line style, add axis labels and add a legend to the graphs (using title, xlabel, ylabel, legend and grid).
Exercise 8. Define a vector x that ranges from 0 to 100 by steps of size 0.5. Plot
sin(x) and 1 + cos(x) on the same graph. Represent the sine curve with a dashed
line and the cosine curve by a dashdot. Also label the graph and save it as a script.
Exercise 9. Polynomials. Answer the questions: (a) Represent the polynomial s5 + 3s3 + 7s2 + 3s + 4 and find its roots (use the command roots). (b)
Considering the roots of the polynomial , -3, -8, -5, represent this polynomial (use
the command poly).
Exercise 10. Creating models. Considering the following transfer function:
G(s) =

s2

(s + 2)
+ 4s + 3

Create it using polynomials coefficients (using tf).


Try creating it by using zeros, poles and gain (using zpk).
Which is the canonical gain? (using dcgain).
Include a delay of 0.5s in the previous transfer function.
Exercise 11. Transfer function. Type with Matlab the following transfer
functions using zpk or tf:
G1(s) =

s3 s+2
s5 +2s4 +3s3 6s2 +2s+1

G2(s) =

3
s2 +7s+6

G3(s) =

7(s+1)(s2)
e4.7s
(s+5)(s+4)(s+3)

G4(s) =

4
(s2)(s+3)

G5(s) =

s2 2s+2
(s+2)(s+3)(s+4)

If the transfer function is in polynomial form then convert this expression to zeros
and poles and vice-versa.
Exercise 12. Manipulating blocks (I). Obtain the equivalent transfer func0.1
1
, G2(s) = 1s , G3(s) = s+2
and
tion of the following block scheme with G1(s) = s+4
H(s) = 10. Use the commands series, parallel, feedback.

Exercise 13. Manipulating blocks (II). Obtain the equivalent transfer


7s+4
function of the following block scheme with G1(s) = 3.5, G2(s) = s3 +2s
2 +3s+5 ,
3
5
G3(s) = s+4 and G4(s) = 2s+4 .

Exercise 14. Manipulating blocks (III). Obtain the equivalent transfer


3
s+4
function of the following block scheme with G1(s) = s+7
, G2(s) = s2 +3s+1
, G3(s) =
s+4
.
s+3

Work to be done
1. Get familiar with matlab by performing all the tasks at the laboratory, asking
the teacher.
2. The work must be done individually, since it is necessary that students master
the subject. Some of the final exam will address topics covered in the labs.
4

3. Write a precise report using the Publish tool, embedded into MATLAB IDE.
For further information ask google for publishing matlab code or getting pdf
from matlab code.

Deadline
Upload to the virtual platform both the matlab-script and the pdf-file generated.
Deadline: November 6th 2015, 23:55h.

Vous aimerez peut-être aussi