Assignment 1: Answer.1 Syms T P (T) T 2+2 t+1
Assignment 1: Answer.1 Syms T P (T) T 2+2 t+1
AIM: Define polynomial function in MATLAB and find the roots and values of
polynomial function.
Answer.1
>> syms t
>> p=sym2poly(p)
p= 1 2 1
p_value = 4
>> r = roots(p)
r = -1 ,-1
Answer.2
>> a=sym2poly(p1)
a= 1 0 2 6
>> poly2sym(a)
Answer.3
>> f= 8*t^6+4*t^5+2*t^3+7*t+2
f_new = 8 4 0 2 0 7 2
G=
s+1
-------------
s^2 + 3 s + 1
rj =
(s+1)
-------------------
(s+2.618) (s+0.382)
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.
>> k=[1];
>> rj=zpk(z,p,k)
rj =
(s+2) (s+1)
-------------
(s+3)^2 (s+5)
>> h=tf(rj)
s^2 + 3 s + 2
------------------------
s^3 + 11 s^2 + 39 s + 45
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
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)
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
c = 0.5000
0.5000
p = -3
-1
k = []
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
z = -1
p = -2.6180
-0.3820
k=1
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)
b=
s^2 + 3 s + 2
------------------------
s^3 + 11 s^2 + 39 s + 45
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
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
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.
plot the open loop and close loop characteristics and find the effect of PID
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.
.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.
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.
c. )To remove steady state error completely an Integral Controller should be used.