controls lab manual
DESCRIPTION
helps in matlab simulations of various systemsTRANSCRIPT
Second order system
CODE zeta=input('input the value of zeta ='); t=input('input the vlaue of time constant chosen='); wn=1/(zeta*t) num=[wn*wn] den=[1 2*zeta*wn wn*wn] sys=tf(num,den); figure(2); pzmap(sys) f=input('press any key for the step response'); step(sys)
Procedure
Open matlab, open the editor and type the above code.
Save the code and run it. Go to the command window and and
enter the value of zeta and t. The pole zero plot is shown. Enter any key to get the step response
input the value of zeta =2 input the vlaue of time constant chosen=5
wn =
0.1000
num =
0.0100
den =
1.0000 0.4000 0.0100
Transfer function = .001 s^2+0.4s+.001
Pole zero plot
Step response
secondor input the value of zeta =0.1 input the vlaue of time constant chosen=5
wn =
2
num =
4
den =
1.0000 0.4000 4.0000
Pole zero
Step response
input the value of zeta =1 input the vlaue of time constant chosen=5
wn =
0.2000
num =
0.0400
den =
1.0000 0.4000 0.0400
Pole zero
Step response
Lead network Code phi_deg=input('input the given value of phi in degrees=') phi_rad=pi*phi_deg/180 wm=input('input the given value of frequency in radians per second=') alpha=(1-sin(phi_rad))/(1+sin(phi_rad)) T=1/(sqrt(alpha)*wm) f1=1/(2*pi*T) fm=wm/(2*pi); f2i=(pi*T*alpha)/2 C=0.11e-06 R1=T/C R2=alpha*R1/(1-alpha) numg=[1 1/T] deng=[1 1/(alpha*T)] sys=tf(numg,deng) figure(2); pzmap(sys) f=input('Press any key to observe the plot') bode(sys)
Procedure
input the given value of phi in degrees=54.9
phi_deg =
54.9000
phi_rad =
0.9582
input the given value of frequency in radians per second=2010
wm =
2010
alpha =
0.1000
T =
0.0016
f1 =
101.1715
f2i =
2.4715e-04
C =
1.1000e-07
R1 =
1.4301e+04
R2 =
1.5894e+03
numg =
1.0000 635.6795
deng =
1.0e+03 *
0.0010 6.3556
sys = s + 635.7 --------- s + 6356 Continuous-time transfer function.
Press any key to observe the plot
Pole zero
Bode plot
Lag network
phi_deg=input('input the given value of phi in degrees=')
phi_rad=pi*phi_deg/180 wm=input('input the given value of
frequency in radians per second =') beta=(1-sin(phi_rad))/(1+sin(phi_rad)) T=1/(sqrt(beta)*wm) f1=1/(2*pi*beta*T) fm=wm/(2*pi); f2=1/(2*pi*T)
C=1.0e-06 R2=T/C R1=(beta-1)/R2 numg=[1 1/T] deng=[beta*T 1] sys=tf(numg,deng) figure(2); pzmap(sys) f=input('Press any key to observe the plot') figure(3); bode(sys)
Procedure
input the given value of phi in degrees=-54.8
phi_deg =
-54.8000
phi_rad =
-0.9564
input the given value of frequency in radians per second =198.8
wm =
198.8000
beta =
9.9376
T =
0.0016
f1 =
10.0368
f2 =
99.7419
C =
1.0000e-06
R2 =
1.5957e+03
R1 =
0.0056
numg =
1.0000 626.6970
deng =
0.0159 1.0000
sys = s + 626.7
------------- 0.01586 s + 1 Continuous-time transfer function.
Press any key to observe the plot
f =
[]
>>
Bode plot
Pole zero
num=[1] den=conv(conv([1 0],[.2 1]),[.05 1]) sys=tf(num,den) figure(1); bode(sys) [mag,phase,w]=bode(sys) margin(sys) f=input('press any key to uose the rltool') figure(2); rltool(sys)
num =
1
den =
0.0100 0.2500 1.0000 0
sys = 1 ----------------------- 0.01 s^3 + 0.25 s^2 + s Continuous-time transfer function.
procedure
The transfer function is shown. Press any key to get the bode plot The magnitude and phase value of w is
shown. Press any key to get the root locus of the
transfer function.