Você está na página 1de 9

GAZIANTEP UNIVERSITY, ENGINEERING FACULTY

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

EEE 352 AUTOMATIC CONTROL SYSTEMS LABORATORY

Repor
t
Cover
R(s) E(s)=R(s)-Ys(s) U(s) Y(s)
Gc(s) Gp(s)
Desired System
Input Output
Controller Plant
( Compensator) ( System)
Ys(s)
H(s)
Measurement
( Sensors)

Experiment Number & Title : Experiment 1 Introduction to MATLAB: MATrix


LABoratory.

Student Num, Name and Surname : 201193824 Zeynal Abidin ABA


Education :I
Group Num :
Group members Name and Surname :

Experiment Date : 19.02.2015


Report Submitting Date :
Teaching Assistant :
Date and Signature : ......../.../.........,

The Performance and Marks: No credits will be given if pre lab study isnt submitted
before the lab start and if the report doesnt contain the experimental results and the
conclusions.

PR: The pre lab study (tasks and answers the problems, analyze and design results) :
R1: The solution of tasks, problems, analysis and design done by using the
experiment results :
R2: Experimental results :
R3: Conclusions :
Total (T = 40% R1 +20% R2+40% R3) : / 100

Instructor: Prof. Dr. Ahmet Uar

GAZIANTEP UNIVERSITY, ENGINEERING FACULTY


DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EEE 352 AUTOMATIC CONTROL SYSTEMS LABORATORY
Pre Lab Studies Cover

Experiment Number & Title :

Student Num, Name and Surname : 201193824 Zeynal Abidin ABA


Education : I
Group Num :
Group members Name and Surname :

Instructor and Teaching Assistant :


Date and Signature : ......../.../.........,

Tasks and answers the


problems : Analyze and design
results :
PR: The pre lab study (T+A) : / 20
Instructor: Prof. Dr. Ahmet Uar
----------- Start from here --------------------

Task 8.1: Explain the following commands and write returns from the
workspace;
A = [1 2 3; 4 5 6; 7 8 10];
P= A*inv(A) %inv(A) is inverse of matrix A
P=

1.0000 0 -0.0000
0 1.0000 0
0 0 1.0000
>> B=A.^3 % with this, we can take 3. Power of each element

B=

1 8 27
64 125 216
343 512 1000
>> C= [3+4i 0 0; 0 4+3j 0; 0 0 -10];
>> A(1:3,2) % with this, we can choose number of 2. Column 1. Number to 3.
Number

ans =

2
5
8
>> max(A)

ans =

7 8 10

>> D=[A,B] % we can use matrixs to create a new matrix

D=

1 2 3 1 8 27
4 5 6 64 125 216
7 8 10 343 512 1000
>> E= magic(4)

E=

16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
La=eig(A) % to find eigen value of a matrix

La =

16.7075
-0.9057
0.1982>> Lc=eig(C)

Lc =

3.0000 + 4.0000i
4.0000 + 3.0000i
-10.0000

Task 8.2: Write an M-File to


a) Define the vector x starts from 0 with 0.01 step size to 2* and y = sin(x).
b) Plot the graph y versus x.
a) x=0:0.01:2*pi;
y=sin(x);

b)
plot(x,y)
xlabel('x'),ylabel('y'),grid
title('Zeynal Abidin ABA')
Task 8.3: Explain the commands given in the following M-file and write returns
from the workspace

x = 0:pi/100:2*pi;
y = sin(x);
subplot(2,1,1); plot(x,y)
ylabel('sin(x) ')
xlabel('time(sec) ')
y2 = cos(x);
subplot(2,1,2); plot(x,y2)
ylabel('cos(x) ')
xlabel('time(sec) ')
>> title('Zeynal Abidin ABA')
Task 8.4: Explain the commands given in the following M-file and write returns
from the workspace
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
hold on
y2 = cos(x);
plot(x,y2,'r:')
legend('sin','cos')
xlabel('t')
ylabel('sin(x) & cos(x)')
title('Plot of the Sine & Cosine Function from Zeynal Abidin ABA')
Task 8.5: Write an M-File to
a) Find the roots of the polynomial P1(x)=x^2-3x+2
b) Create a polynomial P2(x) with roots in 1, -3, 5 and 2.
c) Multiply the polynomials Pm(x)=P1(x).P2(x) defined in (a) and (b).
d) Divide the polynomials Pd(x)=P1(x)/P(x) defined in (a) and (b).

a) P1x=[1 -3 2]

P1x =

1 -3 2

>> r=roots(P1x)

r=

2
1
b) nr=[1 -3 5 2]
P2x=poly(nr)

P2x =

1 -5 -7 41 -30

c) Pmx=conv(P1x,P2x)

Pmx =

1 -8 10 52 -167 172 -60


d) Pdx=deconv(P1x,P2x)

Pdx =

Task 8.6: Use help to read information for residue built in function.
Write an M-File to get the fraction expansion of
P(s)=(s^2-3s+2)/(s^4-6s^3+5s^2+2s)
Answer: >> bs=[1 -3 2];
as=[1 -6 5 2];
>> [r,p,k] = residue(bs,as)

r=

0.6215
0.0405 %Column vector of residues
0.3380

p=

4.8951
1.3973 %Column vector of poles
-0.2924

k=

[] %Row vector of direct terms

Task 8.7: Write an M-File to solve x=[x1 x2 x3)^T for the following the
equation system Ax=B

Answer;

A=[5 6 0; 3 6 1; 8 7 9];
B=[6;1;4];
x=inv(A)*B

x=

2.0826
-0.7355
-0.8347

Task 8.8:
Write an M-Function to model and M-File to solve the differential equation
given in equation (1) and Plot x(t) for the time frame 0 to 10 sec.

Answer:

syms x1 x2;
[z1,z2]=dsolve('x1(0)=1','x2(0)=0','Dx1=x2','Dx2=-3*x1-5*x2');
x=z1*z2;
ezplot(x,[0 10])
title('Zeynal Abidin ABA')

Você também pode gostar