diff options
Diffstat (limited to '3885/CH6')
-rw-r--r-- | 3885/CH6/EX6.1/Ex6_1.sci | 47 | ||||
-rw-r--r-- | 3885/CH6/EX6.11/Ex6_11.sci | 26 | ||||
-rw-r--r-- | 3885/CH6/EX6.12/Ex6_12.sci | 26 | ||||
-rw-r--r-- | 3885/CH6/EX6.13/Ex6_13.sci | 31 | ||||
-rw-r--r-- | 3885/CH6/EX6.14/Ex6_14.sci | 34 | ||||
-rw-r--r-- | 3885/CH6/EX6.15/Ex6_15.sci | 34 | ||||
-rw-r--r-- | 3885/CH6/EX6.16/Ex6_16.sci | 39 | ||||
-rw-r--r-- | 3885/CH6/EX6.2/Ex6_2.sce | 45 | ||||
-rw-r--r-- | 3885/CH6/EX6.3/Ex6_3.sci | 45 | ||||
-rw-r--r-- | 3885/CH6/EX6.4/Ex6_4.sci | 39 | ||||
-rw-r--r-- | 3885/CH6/EX6.5/Ex6_5.sci | 41 | ||||
-rw-r--r-- | 3885/CH6/EX6.6/Ex6_6.sci | 40 | ||||
-rw-r--r-- | 3885/CH6/EX6.9/Ex6_9.sci | 54 |
13 files changed, 501 insertions, 0 deletions
diff --git a/3885/CH6/EX6.1/Ex6_1.sci b/3885/CH6/EX6.1/Ex6_1.sci new file mode 100644 index 000000000..a11b65857 --- /dev/null +++ b/3885/CH6/EX6.1/Ex6_1.sci @@ -0,0 +1,47 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.1
+
+clc;
+clear;
+s=poly(0,'s')
+//calculation of gain K
+//for ramp input ess(steady state error ) is0.2
+ess=0.2
+kv=1/ess
+// open loop transfer function G(s)=K/s*(1+2*s)
+//by definition of velocity error constant applying limit s=0 in G(s)
+disp('the value of K is 5;')
+h=syslin('c',5/(s*(1+2*s)))
+bode(h)
+show_margins(h)
+xtitle("uncompensated system")
+//from the plot the phase margin of uncompensated system is 18
+//but the system requires phase margin of 40 so lag compensation required
+pm=45//choose PM of compensated system is 45 degree
+phigcn=45-180// phase of G(s) at new gain cross over frequency
+wgcn=0.5//the frequency corrosponding to phase of -135 is 0.5 rad/sec
+agcn=20//db magnitude at wgcn
+//20log betaa=20
+betaa=10^(agcn/20)
+disp(betaa,'the value for betaa is')
+zc=wgcn/10//zero of lag compensator
+t=10/wgcn
+disp(t,'the value for t is')
+pc=1/(betaa*t)
+disp(pc,'pole of lag compensator is')
+//transfer function of lag compensation is (s+1/t)/(s+1/betaa*t))
+hc=syslin('c', (10*(1+20*s))/(1+200*s))
+disp(hc,'the transfer function of lag compensator is;')
+//open loop transfer function of compensated system is h*hc
+hcmp=syslin('c',h*hc)
+disp(hcmp,'open loop transfer function of compensated system is')
+figure()
+bode(hcmp)
+show_margins(hcmp)
+xtitle("compensated system")
+
+
diff --git a/3885/CH6/EX6.11/Ex6_11.sci b/3885/CH6/EX6.11/Ex6_11.sci new file mode 100644 index 000000000..2d6ae51eb --- /dev/null +++ b/3885/CH6/EX6.11/Ex6_11.sci @@ -0,0 +1,26 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.11
+
+clc;
+clear;
+s=poly(0,'s')
+//given tranfer function g(s)=10/(s*(1+2*s)*(1+s))
+h=syslin('c',10/(s*(1+2*s)*(1+s)))
+pm=30//given phase margin
+w=6.2//given gain cross over frequency in rad/sec
+//put s=jw in G(s) magnitude of G(jw) gives A1 and angle of G(jw) gives phi1 at w
+A1=2.052
+phi=-207.5//in degrees
+theta=30-(-27.5)//desired pm -pm of uncompensated system
+kd=sind(theta)/w*A1//derivative constant
+kp=cosd(theta)/A1//proportional constant
+disp(kd,kp,'the values of derivative constant and proportional constant are')
+//transfer function of PD controller is (kp+kd*s)
+hc=syslin('c', s*((0.343/s)+0.262))
+disp(hc,'the transfer function of PD controller is')
+hcmp=syslin('c', h*hc)
+disp(hcmp,'the transfer function of compensated system is')
diff --git a/3885/CH6/EX6.12/Ex6_12.sci b/3885/CH6/EX6.12/Ex6_12.sci new file mode 100644 index 000000000..b76533c30 --- /dev/null +++ b/3885/CH6/EX6.12/Ex6_12.sci @@ -0,0 +1,26 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.12
+
+clc;
+clear;
+s=poly(0,'s')
+//given tranfer function g(s)=100/(s+1)*(s+2)*(s+5)
+h=syslin('c',100/(s+1)*(s+2)*(s+5))
+pm=60//given phase margin
+w=0.5//given gain cross over frequency in rad/sec
+//put s=jw in G(s) magnitude of G(jw) gives A1 and angle of G(jw) gives phi1 at w
+A1=8.63
+phi=-46//in degrees
+theta=pm-134//desired pm -pm of uncompensated system
+ki=(-w)*sind(theta)/A1//integral constant
+kp=cosd(theta)/A1//proportional constant
+disp(ki,kp,'the values of integral constant and proportional constant are')
+//transfer function of PI controller is (kp+ki/s)
+hc=syslin('c', 0.056*(1+0.57*s)/s)
+disp(hc,'the transfer function of PD controller is')
+hcmp=syslin('c', h*hc)
+disp(hcmp,'the transfer function of compensated system is')
diff --git a/3885/CH6/EX6.13/Ex6_13.sci b/3885/CH6/EX6.13/Ex6_13.sci new file mode 100644 index 000000000..71b989efc --- /dev/null +++ b/3885/CH6/EX6.13/Ex6_13.sci @@ -0,0 +1,31 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.13
+
+clc;
+clear;
+s=poly(0,'s')
+//given tranfer function g(s)=100/(s+1)*(s+2)*(s+10)
+h=syslin('c',100/(s+1)*(s+2)*(s+10))
+pm=45//given phase margin
+w=4//given gain cross over frequency in rad/sec
+//put s=jw in G(s) magnitude of G(jw) gives A1 and angle of G(jw) gives phi1 at w
+A1=0.5
+phi=-161//in degrees
+theta=pm-19//desired pm -pm of uncompensated system
+ess=0.1//steady state error for ramp input
+kv=1/ess//velocity errpr constant
+//the transfer function of PID controller is Gc(s)=kp+kd*s+ki/s
+//by definition of velocity error constant applying s=0 in S*Gc(s)*G(s)
+ki=2//integeral constant
+disp(ki,'the value of integral constant')
+kd=((sind(theta)/(w*A1))+(ki/w^2))//derivative constant
+kp=cosd(theta)/A1//proportional constant
+disp(kd,kp,'the values of proportional constant and derivative constant are')
+hc=syslin('c',0.344*(s^2+5.23*s+5.81)/s)
+disp(hc,'the transfer function of PID controller is')
+hcmp=syslin('c',h*hc)
+disp(hcmp,'the transfer function of compensated system is')
diff --git a/3885/CH6/EX6.14/Ex6_14.sci b/3885/CH6/EX6.14/Ex6_14.sci new file mode 100644 index 000000000..e1257acc2 --- /dev/null +++ b/3885/CH6/EX6.14/Ex6_14.sci @@ -0,0 +1,34 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.14
+
+clc;
+clear;
+s=poly(0,'s')
+//dominent pole sd=-zeta*w=%i*w*sqrt(1-zeta^2)
+zeta=0.8//damping ratio
+w=2//natural frequency of osciilation in rad/sec
+sd=(-zeta*w)+((%i*w)*sqrt(1-zeta^2))
+disp(sd,'the dominennt pole is')
+d=abs(sd)
+disp(d,'the value of d is ')
+betaa=phasemag(sd)
+disp(betaa,'the value of betaa is;')
+h=syslin('c',20/s*(s+2)*(s+4))//given tranfer function G(s)
+//find magnitude and phase of G(s) at s=sd
+a=20/(sd*(2+sd)*(4+sd))
+ad=abs(a)
+disp(ad,'the value of ad is')
+phid=phasemag(a)
+disp(phid,'the value of phid is')
+kd=sind(phid)/(d*ad*sind(betaa))//derivative constant
+disp(kd,'the derivative constant is')
+kp=(-sind(betaa+phid))/(ad*sind(betaa))//proportional constant
+disp(kp,'the integral constant is')
+hc=syslin('c', s*((0.243/s)+0.557))//transfer function of PD controller is kpof +kd*s
+disp(hc,'transfer function of PD controller is')
+hcmp=syslin('c',h*hc)//transfer function compensated system
+disp(hcmp,'transfer function compensated system ')
diff --git a/3885/CH6/EX6.15/Ex6_15.sci b/3885/CH6/EX6.15/Ex6_15.sci new file mode 100644 index 000000000..1f1088532 --- /dev/null +++ b/3885/CH6/EX6.15/Ex6_15.sci @@ -0,0 +1,34 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.15
+
+clc;
+clear;
+s=poly(0,'s')
+//dominent pole sd=-zeta*w=%i*w*sqrt(1-zeta^2)
+zeta=0.9//damping ratio
+w=2.5//natural frequency of osciilation in rad/sec
+sd=(-zeta*w)+((%i*w)*sqrt(1-zeta^2))
+disp(sd,'the dominennt pole is')
+d=abs(sd)
+disp(d,'the value of d is ')
+betaa=phasemag(sd)
+disp(betaa,'the value of betaa is;')
+h=syslin('c',4/(s+1)*(s+5))//given tranfer function G(s)
+//find magnitude and phase of G(s) at s=sd
+a=4/((1+sd)*(5+sd))
+ad=abs(a)
+disp(ad,'the value of ad is')
+phid=phasemag(a)
+disp(phid,'the value of phid is')
+ki=-(d*sind(phid))/(ad*sind(betaa))//integral constant
+disp(ki,'the integral constant is')
+kp=(-sind(betaa+phid))/(ad*sind(betaa))-(2*ki*cosd(betaa))/d //proportional constant
+disp(kp,'the proportional constant is')
+hc=syslin('c', 2.02*(s+1.19)/s)//transfer function of PD controller is kpof +kd*s
+disp(hc,'transfer function of PI controller is')
+hcmp=syslin('c',h*hc)//transfer function compensated system
+disp(hcmp,'transfer function compensated system ')
diff --git a/3885/CH6/EX6.16/Ex6_16.sci b/3885/CH6/EX6.16/Ex6_16.sci new file mode 100644 index 000000000..1b0933b5f --- /dev/null +++ b/3885/CH6/EX6.16/Ex6_16.sci @@ -0,0 +1,39 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.15
+
+clc;
+clear;
+s=poly(0,'s')
+//dominent pole sd=-zeta*w=%i*w*sqrt(1-zeta^2)
+zeta=0.8//damping ratio
+w=2.5//natural frequency of osciilation in rad/sec
+sd=(-zeta*w)+((%i*w)*sqrt(1-zeta^2))
+disp(sd,'the dominennt pole is')
+d=abs(sd)
+disp(d,'the value of d is ')
+betaa=phasemag(sd)
+disp(betaa,'the value of betaa is;')
+h=syslin('c',75/(s+1)*(s+3)*(s+8))//given tranfer function G(s)
+//find magnitude and phase of G(s) at s=sd
+a=75/((1+sd)*(3+sd)*(8+sd))
+ad=abs(a)
+disp(ad,'the value of ad is')
+phid=phasemag(a)
+disp(phid,'the value of phid is')
+ess=0.08//steady state error
+kv=1/ess//velocity error constant
+//the transfer function of PID controller is Gc(s)=kp+kd*s+ki/s
+//by definition of velocity error constant applying s=0 in S*Gc(s)*G(s)
+ki=12.5/3.125//integeral constant
+kd=sind(phid)/(d*ad*sind(betaa))+(ki/(d^2)) //derivative constant
+disp(kd,'the derivative constant is')
+kp=(-sind(betaa+phid))/(ad*sind(betaa))-(2*ki*cosd(betaa))/d //proportional constant
+disp(kp,'the proportional constant is')
+hc=syslin('c', 0.68*(s^2+4.26*s+5.88)/s)//transfer function of PID controller is kpof +kd*s
+disp(hc,'transfer function of PI controller is')
+hcmp=syslin('c',h*hc)//transfer function compensated system
+disp(hcmp,'transfer function compensated system ')
diff --git a/3885/CH6/EX6.2/Ex6_2.sce b/3885/CH6/EX6.2/Ex6_2.sce new file mode 100644 index 000000000..a413259da --- /dev/null +++ b/3885/CH6/EX6.2/Ex6_2.sce @@ -0,0 +1,45 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.2
+
+clc;
+clear;
+s=poly(0,'s')
+//calculation of gain K
+kv=30//velocity error constant is 30sec^-1
+// open loop transfer function G(s)=K/s*(s+4)*(s+80)
+//by definition of velocity error constant applying limit s=0 in G(s)
+disp('the value of K is 9600;')
+h=syslin('c',9600/(s*(s+4)*(s+80)))
+bode(h)
+show_margins(h)
+xtitle("uncompensated system")
+//from the plot the phase margin of uncompensated system is 12
+//but the system requires phase margin of 33 so lag compensation required
+pm=38//choose PM of compensated system is 38 degree
+phigcn=38-180// phase of G(s) at new gain cross over frequency
+wgcn=4.7//the frequency corrosponding to phase of -142 is 4.7 rad/sec
+agcn=16//db magnitude at wgcn
+//20log betaa=16
+betaa=10^(agcn/20)
+disp(betaa,'the value for betaa is')
+zc=wgcn/10//zero of lag compensator
+t=10/wgcn
+disp(t,'the value for t is')
+pc=1/(betaa*t)
+disp(pc,'pole of lag compensator is')
+//transfer function of lag compensation is (s+1/t)/(s+1/betaa*t))
+hc=syslin('c', (6.3*(1+2.13*s))/(1+13.419*s))
+disp(hc,'the transfer function of lag compensator is;')
+//open loop transfer function of compensated system is h*hc
+hcmp=syslin('c',h*hc)
+disp(hcmp,'open loop transfer function of compensated system is')
+figure()
+bode(hcmp)
+show_margins(hcmp)
+xtitle("compensated system")
+
+
diff --git a/3885/CH6/EX6.3/Ex6_3.sci b/3885/CH6/EX6.3/Ex6_3.sci new file mode 100644 index 000000000..331501dd3 --- /dev/null +++ b/3885/CH6/EX6.3/Ex6_3.sci @@ -0,0 +1,45 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.3
+
+clc;
+clear;
+s=poly(0,'s')
+K=20//the value of K
+h=syslin('c',20/(s*(s+2)*(s+8)))
+evans(h)
+xtitle("uncompensated system")
+//given ramp input ess(steady state error ) is0.125
+ess=0.125
+kvd=1/ess//desired velocity error constant
+// transfer function of un compessated system G(s)=20/s*(s+2)*(s+8)
+//by definition of velocity error constant applying limit s=0 in G(s)
+kvu=1.25
+disp(kvu,'The velocity error constant of un compensated system is')
+disp(kvd,'desired velocity error constant')
+A=kvd/kvu//A is the factor by which velocity error constant increases
+betaa=A*1.2
+disp(betaa,'the value of betaa is')
+zc=0.1*(-2)//zero of lag compensator=0.1* second pole
+t=(-1/zc)
+disp(t,'the value for t is')
+pc=(-1)/(betaa*t)//pole of lag compensator
+//transfer function of lag compensation is (s+1/t)/(s+1/betaa*t))
+hc=syslin('c',(s+0.2*s)/(s+0.026*s))
+disp(hc,'transfer function of lag compensation is')
+//open loop transfer function of compensated system is h*hc
+hcmp=syslin('c', h*hc)
+disp(hcmp,'open loop transfer function of compensated system is')
+figure()
+evans(hcmp)
+xtitle("compensated system")
+//by definition of velocity error constant applying limit s=0 in hcmp
+kvc=9.165//velocity error constant of compensated system
+essc=1/kvc//steady state error for compensated system
+disp(essc,'steady state error for compensated system')
+disp('since the steady state error of compensated system is less than 0.125 the design is acceptable')
+
+
diff --git a/3885/CH6/EX6.4/Ex6_4.sci b/3885/CH6/EX6.4/Ex6_4.sci new file mode 100644 index 000000000..c67536baf --- /dev/null +++ b/3885/CH6/EX6.4/Ex6_4.sci @@ -0,0 +1,39 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.4
+
+clc;
+clear;
+s=poly(0,'s')
+K=240//the value of K
+h=syslin('c',240/(s*(s+10)^2))
+evans(h)
+xtitle("uncompensated system")
+kvd=20//given desired velocity error constant
+// transfer function of un compessated system G(s)=20/s*(s+2)*(s+8)
+//by definition of velocity error constant applying limit s=0 in G(s)
+kvu=2.4
+disp(kvu,'The velocity error constant of un compensated system is')
+disp(kvd,'desired velocity error constant')
+A=kvd/kvu//A is the factor by which velocity error constant increases
+betaa=A*1.2
+disp(betaa,'the value of betaa is')
+zc=0.1*(-10)//zero of lag compensator=0.1* second pole
+t=(-1/zc)
+disp(t,'the value for t is')
+pc=(-1)/(betaa*t)//pole of lag compensator
+//transfer function of lag compensation is (s+1/t)/(s+1/betaa*t))
+hc=syslin('c',(s+1)/(s+0.1))
+disp(hc,'transfer function of lag compensation is')
+//open loop transfer function of compensated system is h*hc
+hcmp=syslin('c', h*hc)
+disp(hcmp,'open loop transfer function of compensated system is')
+figure()
+evans(hcmp)
+xtitle("compensated system")
+//by definition of velocity error constant applying limit s=0 in hcmp
+kvc=24//velocity error constant of compensated system
+disp('since the velocity error constant of compensated system is greater than specified value the design is acceptable')
diff --git a/3885/CH6/EX6.5/Ex6_5.sci b/3885/CH6/EX6.5/Ex6_5.sci new file mode 100644 index 000000000..caff6d671 --- /dev/null +++ b/3885/CH6/EX6.5/Ex6_5.sci @@ -0,0 +1,41 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.5
+
+clc;
+clear;
+s=poly(0,'s')
+//calculation of gain K
+//given for ramp input ess(steady state error ) is 1/15
+ess=1/15
+kv=1/ess
+// open loop transfer function G(s)=K/s*(s+1)
+//by definition of velocity error constant applying limit s=0 in G(s)
+disp('the value of K is 15;')
+h=syslin('c',15/(s*(s+1)))
+bode(h)
+show_margins(h)
+xtitle("uncompensated system")
+//from the plot the phase margin of uncompensated system is 13
+//but the system requires phase margin of 45 so lead compensation required
+pm=45//choose PM of compensated system is 45 degree
+phim=37//maximum lead angle
+alpha=(1-(sind(phim)))/(1+(sind(phim)))
+disp(alpha,'the vale of alpha is')
+wmdb=-20*log(1/sqrt(alpha))////db magnitude
+wm=5.6//from the bode plot of uncompensated system the frequency wm corrosponding to db gain of -6db is 5.6rad/sec
+t=1/(wm*sqrt(alpha))
+disp(t,'the value of t is')
+//transfer function of lead compensator is (s+1/t)/(s+1/alpha*t)
+hc=syslin('c',(0.25*(1+0.36*s))/(1+0.09*s))
+disp(hc,' transfer function of lead compensator is')
+//open loop transfer function of compensated system is h*hc
+hcmp=syslin('c',h*hc)
+disp(hcmp,'open loop transfer function of compensated system is ')
+figure()
+bode(hcmp)
+show_margins(hcmp)
+xtitle("compensated system")
diff --git a/3885/CH6/EX6.6/Ex6_6.sci b/3885/CH6/EX6.6/Ex6_6.sci new file mode 100644 index 000000000..40a0f476d --- /dev/null +++ b/3885/CH6/EX6.6/Ex6_6.sci @@ -0,0 +1,40 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.6
+
+clc;
+clear;
+s=poly(0,'s')
+//calculation of gain K
+kv=50//given velocity error constant
+// open loop transfer function G(s)=K/s*(s+1)(s+5)
+//by definition of velocity error constant applying limit s=0 in G(s)
+disp('the value of K is 250;')
+h=syslin('c',250/(s*(s+1)*(s+5)))
+bode(h)
+show_margins(h)
+xtitle("uncompensated system")
+//from the plot the phase margin of uncompensated system is -44
+//but the system requires phase margin of 20 so lead compensation required
+pm=20//choose PM of compensated system is 20 degree
+//since the lead angle required is greater than 60 we have to realise lead compensator as cascade of two compensators with each compensator providing half of required phase
+phim=69/2//maximum lead angle
+alpha=(1-sind(phim))/(1+sind(phim))
+disp(alpha,'the vale of alpha is')
+wmdb=-20*log(1/sqrt(alpha))////db magnitude
+wm=7.8//from the bode plot of uncompensated system the frequency wm corrosponding to db gain of -6db is 5.6rad/sec
+t=1/(wm*sqrt(alpha))
+disp(t,'the value of t is')
+//transfer function of lead compensator is (s+1/t)/(s+1/alpha*t)
+hc=syslin('c',(0.0784*(1+0.024*s)^2)/(1+0.067*s)^2)
+disp(hc,' transfer function of lead compensator is')
+//open loop transfer function of compensated system is h*hc
+hcmp=syslin('c',h*hc)
+disp(hcmp,'open loop transfer function of compensated system is ')
+figure()
+bode(hcmp)
+show_margins(hcmp)
+xtitle("compensated system")
diff --git a/3885/CH6/EX6.9/Ex6_9.sci b/3885/CH6/EX6.9/Ex6_9.sci new file mode 100644 index 000000000..b4e38f2cc --- /dev/null +++ b/3885/CH6/EX6.9/Ex6_9.sci @@ -0,0 +1,54 @@ +//control systems by Nagoor Kani A
+//Edition 3
+//Year of publication 2015
+//Scilab version 6.0.0
+//operating systems windows 10
+// Example 6.9
+
+clc;
+clear;
+s=poly(0,'s')
+//calculation of gain K
+kv=80//given velocity error constant
+// open loop transfer function G(s)=K/s*(s+3)(s+6)
+//by definition of velocity error constant applying limit s=0 in G(s)
+disp('the value of K is 1440;')
+h=syslin('c',1440/(s*(s+3)*(s+6)))
+bode(h)
+show_margins(h)
+xtitle("uncompensated system")
+//from the plot the phase margin of uncompensated system is -46
+pm=40//choose PM of compensated system is 40 degree
+phigcn=40-180// phase of G(s) at new gain cross over frequency
+wgcn=1.8//the frequency corrosponding to phase of -140 is 1.8 rad/sec
+wgcl=4//choose gain cross over frequency of lag compensator as 4rad/sec
+agcl=23//db magnitude at egcl is 23db
+//agcl=20log*betaa
+betaa=10^(agcl/20)
+disp(betaa,'the value of betaa is')
+zc1=wgcl/10//zero of lag compensator
+t1=10/wgcl
+disp(t1,'the value of t1 is ')
+pc1=1/(betaa*t1)
+disp(pc1,'pole of lag compensator is')
+//transfer function of lag section is (betaa*1+st1)/(1+s*betaa*t1)
+hc1=syslin('c',(14*(1+2.5*s))/(1+35*s))
+disp(hc1,'transfer function of lag section')
+alpha=1/betaa
+disp(alpha,'the value of alpha is')
+wmdb=-20*log(1/sqrt(alpha))////db magnitude
+wm=17//from the bode plot of uncompensated system the frequency wm corrosponding to db gain of -12db is 17rad/sec
+t2=1/(wm*sqrt(alpha))
+//transfer function of lead section is (alpha*1+st2)/(1+s*alpha*t2)
+hc2=syslin('c',(0.07*(1+0.22*s))/(1+0.0154*s))
+disp(hc2,'transfer function of lead section')
+hc3=syslin('c',hc1*hc2)
+disp(hc3,'the tansfer function of lag lead compensation system is')
+//open loop transfer function of compensated system is h*hc3
+hcmp=syslin('c',h*hc3)
+disp(hcmp,'the overll transfer function of compensated system')
+figure()
+bode(hcmp)
+show_margins(hcmp)
+xtitle("compensated system")
+
|