Beruflich Dokumente
Kultur Dokumente
MATLAB PROGRAM-
clc;
clear all;
close all;
num=[1];
den=[1 10 20];
step(num,den)
grid
Output-
MATLAB PROGRAM-
clc;
clear all;
close all;
Kp=300;
num=[Kp];
den=[1 10 20+Kp];
t=0:0.01:2;
step(num,den,t)
grid
Output-
MATLAB PROGRAM-
clc;
clear all;
close all;
Kp=300;
Kd=10
num=[Kd Kp];
t=0:0.01:2
step(num,den,t)
grid
Output-
MATLAB PROGRAM-
clc;
clear all;
close all;
Kp=30;
Ki=70O
t=0:0.01:2
step(num,den,t)
grid
Output-
Experiment No. 2
MATLAB PROGRAM-
clc;
close all;
clear all;
num=[0 0 4];
den=[1 2 4];
t=0:0.05:5
[c1,x1,t]=step(numc,denc,t);
[c2,x2,t]=step(num,den,t);
plot(t,c1,’.’,t,c2,’-‘)
grid
xlabel(‘t in second’)
Output-
Experiment No. 3
Design a Lag Compensator using root locus technique
(A)Unit step response of compensated and uncompensated system.
MATLAB PROGRAM-
clc;
clear all;
close all;
num=[0 0 0 1.06];
den=[1 3 2 1.06];
t=0:0.1:40;
[c1,x1,t]=step(numc,denc,t);
[c2,x2,t]=step(num,den,t);
plot(t,c1,’.’,t,c2,’-‘)
grid
xlabel(‘time in sec’)
ylabel(‘output c1 &c2’)
Output-
MATLAB PROGRAM-
clc;
close all;
clear all;
num=[0 0 4];
den=[1 2 4];
t=0:0.05:5
[c1,x1,t]=step(numc,denc,t);
[c2,x2,t]=step(num,den,t);
plot(t,c1,’.’,t,c2,’-‘,t,t’--‘)
grid
xlabel(‘t in second’)
Output-
MATLAB PROGRAM-
clc;
clear all;
close all;
numc=[0 0 0 1.0235 0.0512];
denc=[1 3.005 2.015 1.0335 0.0512];
num=[0 0 0 1.06];
den=[1 3 2 1.06];
t=0:0.1:40;
[c1,x1,t]=step(numc,denc,t);
[c2,x2,t]=step(num,den,t);
plot(t,c1,'.',t,c2,'-',t,t,'--')
grid
title('Unit ramp response of compensated & uncompensated system')
xlabel('time in sec')
ylabel('output c1 & c2')
Output-
Experiment No. 4
Design a lead compensator using Bode Plot technique
A) Unit step response of compensated and uncompensated
system
MATLAB PROGRAM-
clc;
close all;
clear all;
num=[4];
den=[1 2 4];
numc=[166.8 735.588];
t=0:0.02:6;
[c1,x1,t]=step(num,den,t);
[c2,x2,t]=step(numc,denc,t);
plot(t,c1,’.’,t,c2,’-‘)
grid
xlabel(‘time in sec’);
text(0.4,1.31,’compensated system’)
text(1.55,0.88,’uncompensated system,)
Output-
MATLAB PROGRAM-
clc;
close all;
clear all;
num=[4];
den=[1 2 4 0];
numc=[166.8 735.588];
t=0:0.02:5;
[c1,x1,t]=step(num,den,t);
[c2,x2,t]=step(numc,denc,t);
plot(t,c1,’.’,t,c2,’-‘,t,t,’--‘)
grid
xlabel(‘time in sec’);
text(0.89,3.7,’compensated system’)
text(2.55,1.1’uncompensated system,)
Output-
Experiment No. 5
Design a Lag Compensator using Bode Plot technique
A)Unit step response of compensated and uncompensated system
MATLAB PROGRAM-
clc;
close all;
clear all;
num[1];
numc=[50 5];
t=0:0.1:40;
[c1,x1,t]=step(num,den,t);
[c2,x2,t]=step(numc,denc,t);
plot(t,c1,’.’t,c2,’-‘)
grid
xlabel(‘time in sec’);
text(12.7,1.27,’compensated system’)
text(12.2,0.7,’uncompensated system’)
Output-
MATLAB PROGRAM-
clc;
clear all;
close all;
num=[1];
den=[0.5 1.5 1 1 0];
numc=[50 5];
denc=[50 150.5 101.5 51 5 0];
t=0:0.1:20;
[c1,x1,t]=step(num,den,t);
[c2,x2,t]=step(numc,denc,t);
plot(t,c1,'.',t,c2,'-',t,t,'--')
grid
title('unit ramp response for compensated & uncompensated system');
xlabel('time in sec');
ylabel('o/p c1 & c2');
text(8.3,3,'compensated system')
text(8.3,5,'uncompensated system')
Output-
Experiment No. 6
Software program for Transfer Function to state space
conversion
clc;
clear all;
close all;
num=[5 6 8];
den=[1 3 7 9];
[A B C D]=tf2ss(num,den);
AP=inv(P)*A*P
BP=inv(P)*B
CP=C*P
DP=D
Output-
AP =
0 1 0
0 0 1
-9 -7 -3
BP =
CP =
8 6 5
DP =
Experiment No. 7
(A)Software program to obtain controllability of system.
MATLAB PROGRAM-
clc;
clear all;
close all;
A=[0 1 0;0 0 1;-6 -11 -6]
B=[0;0;1]
C0=ctrb(A,B)
Cr=rank(C0)
Ar=rank(A)
if Cr==Ar
disp('The given system is controllable.')
else
disp('The given system is not controllbale.')
end
Ouput-
A=
0 1 0
0 0 1
-6 -11 -6
B=
0
0
1
C0 =
0 0 1
0 1 -6
1 -6 25
Cr =
3
Ar =
3
MATLAB PROGRAM-
clc;
clear all;
close all;
A=[0 1 0;0 0 1;-6 -11 -6]
C=[1 0 0]
C0=obsv(A,C)
Cr=rank(C0)
Ar=rank(A)
if Cr==Ar
disp('The given system is observable.')
else
disp('The given system is not observable.')
end
Output-
A=
0 1 0
0 0 1
-6 -11 -6
C=
1 0 0
C0 =
1 0 0
0 1 0
0 0 1
Cr =
3
Ar =
3
Experiment No. 8
Determine state feedback gain matrix using Ackerman’s method
MATLAB PROGRAM-
clc;
clear all;
close all;
A=[0 1 0;0 0 1;1 -5 -6];
B=[0;0;1];
J=[-2+j*4;-2-j*4;-10];
K=acker(A,B,J)
Output-
K=
201 55 8