Sie sind auf Seite 1von 24

Assignment 1

AIM: Define polynomial function in MATLAB and find the roots and values of
polynomial function.

Question 1. Consider the polynomial p(t) = t2 + 2t + 1


a. Define the polynomial in MATLAB.
b. Calculate the polynomial's roots.
c. Calculate the value of the polynomial for t = 1.

Answer.1

>> syms t

>> p(t)= t^2+2*t+1

p(t) = t^2 + 2*t + 1

>> p=sym2poly(p)

p= 1 2 1

>> p_value = polyval(p,1)

p_value = 4

>> r = roots(p)

r = -1 ,-1

Control system lab shivam


Question 2. Consider the symbolic polynomial p(t) = t3 + 2t + 6.
a. Convert the symbolic polynomial to polynomial matrix.
b. Convert the polynomial matrix back to the symbolic polynomial.

Answer.2

>> p1(t) = t^3+2*t+6

p1(t) = t^3 + 2*t + 6

>> a=sym2poly(p1)

a= 1 0 2 6

>> poly2sym(a)

ans = x^3 + 2*x + 6

Control system lab shivam


Question 3. Consider the polynomial p(t) = 8t6 + 4t5 + 2t3 + 7t + 2. Define and Extract the
coefficients of this polynomial. Identify the difference in the use of sym2poly & coeffs commands
output.

Answer.3

>> f= 8*t^6+4*t^5+2*t^3+7*t+2

f = 8*t^6 + 4*t^5 + 2*t^3 + 7*t + 2

>> f_new =sym2poly(f)

f_new = 8 4 0 2 0 7 2

Question 5. Create the following transfer function using tf(num,den)


H(s) = s + 1
s2 + 3s + 1
and then convert from tf model (polynomial form) to zpk model (factored
form).

>> G=tf([1 1],[1 3 1])

G=

s+1

-------------

s^2 + 3 s + 1

Continuous-time transfer function

Control system lab shivam


>> rj=zpk(G)

rj =

(s+1)

-------------------

(s+2.618) (s+0.382)

Continuous-time zero/pole/gain model.

Question 6. Create the following transfer function in pole zero model T(s)
= (s + 2)(s + 1)
(s + 3)2(s + 5)
Then, convert this transfer function from factored form to polynomial form.

>> z=[-2 -1];

>> p=[-3 -3- 5];

>> k=[1];

>> rj=zpk(z,p,k)

rj =

(s+2) (s+1)

-------------

(s+3)^2 (s+5)

Continuous-time zero/pole/gain model.

>> h=tf(rj)

Control system lab shivam


h=

s^2 + 3 s + 2

------------------------

s^3 + 11 s^2 + 39 s + 45

Continuous-time transfer functions

conclusion: By using Matlab roots of polynomial has been found.

Control system lab shivam


Assignment 2
Aim: To Define The Transfer function in MATLAB and find its responses.

Question 1. Consider the following transfer function


G1(s) = 1
(s + 2)(s + 3)

Design the step response of the system. Then consider a new transfer
function
G2(s) = 10
(s + 2)(s + 3)(s + 10)

and on the same diagram design the step response for the second system.

Answers 1
Clc
clear all
p = [-2,-3];
z = [];
k = [1];
g = zpk(z,p,k);
step [g];
hold on
p = [-2,-3,-10];
z= [];
k= [10];
f= zpk(z,p,k);
step (f);
hold off
run

Control system lab shivam


Control system lab shivam
Question 2. Consider a system with transfer function
H(s) = 2s = 2s
(s + 2)(s2 + 2s + 2) s3 + 4s2 + 6s + 4
Define the transfer function to MATLAB. Then in a tab with two sub-windows design the
impulse and step response of the system.
Answer.2
clc
clear all
num =[2,0]
den =[1 ,4,6,4]
g = tf(num,den)
subplot (1,2,1)
step (g)
subplot (1,2,2)
impulse (g)

Control system lab shivam


Question 3. Consider a system with the following transfer function:
G(s) = s2 + 2s + 1
s3 + 3.8s2 + 8.76s + 5.96

Find the poles and zeros of the system and then in a tab with 3 sub-windows plot:
1. The impulse response of the system
2.
3. The step response of the system
4. The response when we have as input the signal 2cos(1.6t), in the interval [0; 10].

Answer.3

clc
clear all
num = [1,2,1]
den = [1,3.8,8.76,5.96]
g = tf (num,den)
pole (g)
zero ( g)
subplot (3,1,1)
step (g)
subplot (3,1,2)
impulse (g)
subplot (3,1,3)
t = 0:0.1:10
u = 2*cos (1.6*t)
lsim (g,u,t)

Control system lab shivam


Control system lab shivam
Question 4. Consider & Analyse the rational function X(s) as partial fractions.
X(s) = s + 2
s3 + 4s2 + 3s

Answer.4

num=[1,2]
den=[1,4,3]
f=tf(num,den)
[c,p,k]=residue(num,den)

ans

num = 1 2

den = 1 4 3

f=
s+2
-------------
s^2 + 4 s + 3

Continuous-time transfer function.

c = 0.5000
0.5000

p = -3
-1
k = []

Control system lab shivam


Question 5. Create the following transfer function using tf(num,den)
H(s) = s + 1
s2 + 3s + 1

and then convert from tf model (polynomial form) to zpk model (factored
form).

Answer.5

clc
clear all
num=[1,1]
den=[1,3,1]
d=tf(num,den)
[z,p,k]=tf2zp(num,den)

output
num = 1 1
den = 1 3 1

d=
s+1
-------------
s^2 + 3 s + 1

Continuous-time transfer function.

z = -1
p = -2.6180
-0.3820

k=1

Control system lab shivam


Question 6. Create the following transfer function in pole zero model
T(s) = (s + 2)(s + 1)
(s + 3)2(s + 5)

Then, convert this transfer function from factored form to polynomial


form.

clc
clear all
z = [-2,-1];
p = [-3,-3,-5];
k = [1];
a = zpk (z,p,k)
b = tf (a)

a=

(s+2) (s+1)

-------------

(s+3)^2 (s+5)

Continuous-time zero/pole/gain model.

b=

s^2 + 3 s + 2

------------------------

s^3 + 11 s^2 + 39 s + 45

Continuous-time transfer functions

Control system lab shivam


Assignment 3
AIM: To see the effect of change in Forward path Gain

Q1)consider wn = 1 , g=0.5 and k=[0 1 2 5 10] plot the responses on the same
graph and find the effect on the response after the addition of gain in
forward path.

clc;
clear all;
g=0.5;
wn=1;
for k = [ 1 2 5 10]
num = [k*wn^2];
den = [1 2*g*wn k*wn^2];
g1= tf (num,den)
step (g1)
hold on
end

%response shown in fig.1

Control system lab shivam


Q2) consider wn = 1 , g=1 and k=[0 1 2 5 10] plot the responses on the same
graph and find the effect on the response after the addition of gain in
forward path.

clc;
clear all;
g=1;
wn=1;
for k =[1 2 5 10]
num = [k*wn^2];
den =[1 2*g*wn k*wn^2];
g1= tf (num,den)
step (g 1)
hold on
end

Control system lab shivam


%response shown in fig.2

conclusion :-

1) With the increase in the forward path gain, the maximum overshoot
increases.

2) With the increase in the forward path gain, the rise time decreases that is
the system is becoming faster.

3) The damping factor decreases with the increses in gain.

4) settling time is ineffective

Control system lab shivam


ASSIGNMENT 4
clc;
clear all;
close all;
wn=1;
g=0.5;
for p=[1 5 10 20 30 50 ]
num=[wn^2]
den=[1 (p+2*g*wn) 2*g*wn*p wn^2]
g1=tf(num,den)
step(g1)
hold on
end

Control system lab shivam


Q2
clc;
clear all;
close all;
wn=1;
g=0.75;
for p=[1 5 10 20 30 50 70 ]
num=[wn^2]
den=[1 (p+2*g*wn) 2*g*wn*p wn^2]
g1=tf(num,den)
step(g1)
hold on
end

Control system lab shivam


ASSINGMENT:- 5
Aim: To study the effect of P, PI and PID Controller on a second order transfer
function.

Q1. Consider a second order transfer function 0.01/(0.005s^2+0.06s+0.1001)

plot the open loop and close loop characteristics and find the effect of PID

controllers on the close loop characteristics.

 OPEN LOOP DC MOTOR

when we haven transfer function a unity step response.

Control system lab shivam


 CLOSE LOOP DC MOTOR

Control system lab shivam


With proportional controller

At first the Kp(proportional constant) is kept to be of value 1 , and it gave the same result as we
got from close loop.

Control system lab shivam


With proportional-integral controller

.Keeping the previous value of Kp and now adding an Integral controller (Ki),we observe that
the rise time is reduced further and approximately eliminated steady state error. But does not
affect Overshoot.

By keeping Ki > Kp ,we see steady state error is zero.

Control system lab shivam


With P.I.D controller

1. After observing the response for several values we get the desired response in which the
transfer function has - No Overshoot ,Fast rise time and zero steady state error.

* CONCLUSION:

a.) To improve rise time of transfer function one should add a Proportional constant.

b.) Add a Derivative Controller to reduce the overshoot.

c. )To remove steady state error completely an Integral Controller should be used.

Control system lab shivam


Control system lab shivam

Das könnte Ihnen auch gefallen