Final Matlab249
Final Matlab249
IV Semester
Faculty :
Dr. S B
Karajgi
Mrs. Minal salunke
Name : Shankar I B
USN: 01FE21BEE032
Div: A
Subject: LCS
Q1.Figure shows a second order control system with a plant controlled by a PI
controller. The controller gains Kp and Ki are to be determined so as to meet
the following: (i) Closed loop poles placed at (-4±jβ) (ii) Peak time of unit step
response is around 0.5 sec. For the above descriptions, (i) Express the design
specifications in terms of damping ratio (ζ) and natural angular oscillating
frequency (wn). Deduce the required relation for Kp and Ki in terms of ζ and
wn. (iii) Required gains Kp and Ki (iv) Settling time and rise time for these
settings.
MATLAB CODE:
%s1=-4+jb; alpha = 4
alpha=
4;
Tp=0.5
Wd=(pi/Tp);
Wn=sqrt(Wd^2+alpha
^2); geta=4/Wn;
Kp=(2*geta*Wn-4)/10
; Ki=Wn^2/10;
Ts=4/(geta*Wn);
theeta=atan(sqrt((1-(geta^2))/
geta^2)); Tr=(pi-theeta)/Wd;
s=tf('s');
G=(Kp+Ki/s)*(10/
(s+4)); H=1;
TF=G/(1+G*H);
step(TF,10);
Q2. Figure shows the depth control system of a submersible vehicle, where
K=0.5.(i) If K2=0.5 and gain K1 has limits 5 ≤ K1 ≤ 20, obtain the unit step
response with K1 selected for fasted response.(ii) If gain K1 is varied from 1.0
to 7.0 in steps of 1.0, determine the gain K2 values that give time constant ≤
0.1 and plot in the parameter plane K1 - K2. Also compute the corresponding
equivalent gain (Ke) and steady-state errors and comment on the effect of K1
variations on the steady-state error.
MATLAB CODE:
k=0.5;
k2=0.5;
k1=20; k1=20;
%TF=(k1*k)/(s+k1*k2+k1*k);
Tou=1/(k1*(k+k2)); kep=k/(k+k2);
Tou=1/(k1*(k+k2));
values k1_values=1:1:7;
k2_values=0.1./k1_values;
ke=k./(k+k2_values);
ess=1-ke;
vs k2 hold on
grid on
%plot of ke vs ess;
s=tf('s');
G=5/((0.1*s+1)*(0.4*s+1)*(s+
1)); H=1/(0.05*s+1);
TF=G/
(1+G*H); ku =
2.4313;
%to get wn, from routh array form auxillary equation of s^2 row
wn=sqrt(13.157/0.568);
tu=2*pi/wn;
%for pi
controller
kp_pi=0.45*ku
;
ki_pi=0.5*ku/tu;
Gpi=kp_pi+ki_pi/s;
TF_pi=G*Gpi/(1+G*Gpi*H);
%for pid
controller
kp_pid=0.75*ku;
ki_pid=1.2*ku/tu;
kd_pid=0.075*ku
*tu;
Gpid=kp_pid+ki_pid/s+kd_pid*s;
TF_pid=G*Gpid/(1+G*Gpid*H);
a=2
b=
4;
s1=-a+b*i;
%Gc=Kp+Ki/s+Kd*s;
G=0.833*(1/(s1+1))*(40/(3*s1
+1)); H=0.03;
mn=-s1/(G*H);
m=real(mn);
n=imag(mn);
Ki=10;
Ki_range=10:10:30;
Kd=(Ki-m-n*(a/b))/
(a^2+b^2);
Kp=(n+2*a*b*Kd)/b;
s3a=-Ki/
60; s3b=-
20/60;
s3c=-
30/60;
for Ki=Ki_range
s=tf('s');
Gc=Kp+Ki/s+Kd*s
Gp=0.833*(1/(s+1))*(40/
(3*s+1)); H=0.03;
TF=(Gp*Gc)/(1+Gp*Gc*H);
hold on
hold off