summaryrefslogtreecommitdiff
path: root/257/CH11
diff options
context:
space:
mode:
Diffstat (limited to '257/CH11')
-rw-r--r--257/CH11/EX11.1/example_11_1.sce7
-rw-r--r--257/CH11/EX11.10/example_11_10.sce19
-rw-r--r--257/CH11/EX11.11/example_11_11.sce31
-rw-r--r--257/CH11/EX11.12/ex_11_12.sce19
-rw-r--r--257/CH11/EX11.13/example_11_13.sce20
-rw-r--r--257/CH11/EX11.14/ex_11_14.sce25
-rw-r--r--257/CH11/EX11.15/example_11_15.sce21
-rw-r--r--257/CH11/EX11.16/example_11_16.sce13
-rw-r--r--257/CH11/EX11.17/example_11_17.sce23
-rw-r--r--257/CH11/EX11.18/example_11_18.sce23
-rw-r--r--257/CH11/EX11.19/example_11_19.sce26
-rw-r--r--257/CH11/EX11.2/example_11_2.sce24
-rw-r--r--257/CH11/EX11.20/example_11_20.sce11
-rw-r--r--257/CH11/EX11.21/example_11_21.sce24
-rw-r--r--257/CH11/EX11.22/example_11_22.sce15
-rw-r--r--257/CH11/EX11.23/example_11_23.sce20
-rw-r--r--257/CH11/EX11.24/example_11_24.sce29
-rw-r--r--257/CH11/EX11.25/example_11_25.sce20
-rw-r--r--257/CH11/EX11.26/example_11_26.sce19
-rw-r--r--257/CH11/EX11.27/example_11_27.sce21
-rw-r--r--257/CH11/EX11.3/example_11_3.sce21
-rw-r--r--257/CH11/EX11.4/example_11_4.sce15
-rw-r--r--257/CH11/EX11.5/example_11_5.sce24
-rw-r--r--257/CH11/EX11.6/example_11_6.sce28
-rw-r--r--257/CH11/EX11.7/example_11_7.sce28
-rw-r--r--257/CH11/EX11.8/example_11_8.sce51
-rw-r--r--257/CH11/EX11.9/example_11_9.sce24
27 files changed, 601 insertions, 0 deletions
diff --git a/257/CH11/EX11.1/example_11_1.sce b/257/CH11/EX11.1/example_11_1.sce
new file mode 100644
index 000000000..b5496e387
--- /dev/null
+++ b/257/CH11/EX11.1/example_11_1.sce
@@ -0,0 +1,7 @@
+s=poly(0,'s');
+F=syslin('c',[20/((1+0.1*s)*s)])
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+show_margins(F) //display gain and phase margin and associated crossover frequencies
diff --git a/257/CH11/EX11.10/example_11_10.sce b/257/CH11/EX11.10/example_11_10.sce
new file mode 100644
index 000000000..bb07bfd75
--- /dev/null
+++ b/257/CH11/EX11.10/example_11_10.sce
@@ -0,0 +1,19 @@
+//there is a pole at the origin and contribution of gain k
+
+k=10^(14/20) //20*log(k)=14
+
+disp("equation of starting line is y=-20*log(w)+14")
+wc1=10^(0)
+disp(wc1,"hence at wc1, 14=-20*log(wc1)+14. that is wc1 = ")
+y1=poly([1 1/wc1],'s','coeff')
+
+disp("equation of next line is y=-40*log(w)+14")
+wc2=10^(40/40) //-40*log(wc2)=-40
+disp(wc2,"wc2=")
+y2=poly([1 1/wc2],'s','coeff')
+
+wc3=50 //given
+y3=poly([1 1/wc3],'s','coeff')
+
+TF= k*(y2)/((y1)*(y3))
+disp(TF,"transfer function = ")
diff --git a/257/CH11/EX11.11/example_11_11.sce b/257/CH11/EX11.11/example_11_11.sce
new file mode 100644
index 000000000..cb661deb9
--- /dev/null
+++ b/257/CH11/EX11.11/example_11_11.sce
@@ -0,0 +1,31 @@
+s=poly(0,'s');
+F=syslin('c',[1/((1+s)*s*(0.1*s+1))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+// for GM=30 dB, the point on the plot without k is 10dB away from 0dB line.
+k1=10^(-10/20) // 20*log(k1)=-10
+disp(k1,"k for GM=30 is ")
+F1=syslin('c',[(k1)/((1+s)*s*(0.1*s+1))])
+
+[PhaseMargin,freqPM]=p_margin(F1)
+disp(freqPM*2*3.14,"corresponding omegaGC")
+disp(PhaseMargin,"PM=")
+
+// for PM=30degrees, the point on the magnitude plot without k is 6dB away from 0dB line.
+k2=10^(6/20) // 20*log(k1)= 6 dB
+disp(k2,"for PM=30degrees k is ")
+F2=syslin('c',[(k2)/((1+s)*s*(0.1*s+1))])
+
+[PhaseMargin,freqPM]=p_margin(F2)
+disp(freqPM*2*3.14,"corresponding omegaGC")
+[GainMargin,freqGM]=g_margin(F)
+disp(GainMargin,"GM=") \ No newline at end of file
diff --git a/257/CH11/EX11.12/ex_11_12.sce b/257/CH11/EX11.12/ex_11_12.sce
new file mode 100644
index 000000000..078c2ebdd
--- /dev/null
+++ b/257/CH11/EX11.12/ex_11_12.sce
@@ -0,0 +1,19 @@
+s=poly(0,'s');
+F=syslin('c',[(1+0.5*s)/((1+2*s)*s*(1+0.05*s+0.125*s^2))])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*(%pi),"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*(%pi),"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
diff --git a/257/CH11/EX11.13/example_11_13.sce b/257/CH11/EX11.13/example_11_13.sce
new file mode 100644
index 000000000..737a1e969
--- /dev/null
+++ b/257/CH11/EX11.13/example_11_13.sce
@@ -0,0 +1,20 @@
+s=poly(0,'s');
+F=syslin('c',[(1+0.2*s)*(1+0.025*s)/((1+0.001*s)*s^(3)*(0.005*s+1))])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(freqGM*2*3.14,"omegaPC=")
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+//for omegaPC=16.54 ; the plot needs to be shifted by 64dB
+k1=10^(64/20)
+
+//for omegaPC =400 ; the plot needs to be shifted by 100dB
+k2=10^(100/20)
+
+disp(k1,k2,"the 2 values k lies between are")
diff --git a/257/CH11/EX11.14/ex_11_14.sce b/257/CH11/EX11.14/ex_11_14.sce
new file mode 100644
index 000000000..9c08dec20
--- /dev/null
+++ b/257/CH11/EX11.14/ex_11_14.sce
@@ -0,0 +1,25 @@
+s=poly(0,'s');
+F=syslin('c',[1/((1+s)*s*(s+0.5))])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+//disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+//disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+
+if(GainMargin>0 & PhaseMargin>0 )
+ disp("stable system")
+else
+ disp("unstable system")
+end
diff --git a/257/CH11/EX11.15/example_11_15.sce b/257/CH11/EX11.15/example_11_15.sce
new file mode 100644
index 000000000..6d9352b52
--- /dev/null
+++ b/257/CH11/EX11.15/example_11_15.sce
@@ -0,0 +1,21 @@
+disp("equation of first straight line is y=-40*log(w)+c1")
+c1=poly([40*log10(40) 0],'s','coeff') //at w=40 , 0=-40*log(40)+c1
+disp(c1,"where c1 is ")
+A1=-40*log10(10)+c1
+disp(A1,"A1=")
+
+
+disp("equation of second straight line is y=-20*log(w)+c2")
+c2=poly([20*log10(40) 0],'s','coeff') //at w=40 , 0=-20*log(40)+c2
+disp(c2,"where c2 is ")
+wc1=10^( (-20-20*log10(40))/(-20)) // -20=-20*log(wc1)+c2
+disp(wc1,"hence wc1 = ")
+y2=poly([1 1/wc1],'s','coeff')
+A2=-20*log10(1000)+c2
+disp(A2,"A2 = ")
+
+disp("equation of third line is y=-40*log(w)+c3")
+c3= A2+ 40*log10(1000)
+disp(c3,"where c3 = ")
+wc2= 10^((-40-92.0411)/(-40))
+disp(wc2," wc2 = ")
diff --git a/257/CH11/EX11.16/example_11_16.sce b/257/CH11/EX11.16/example_11_16.sce
new file mode 100644
index 000000000..41a70a55a
--- /dev/null
+++ b/257/CH11/EX11.16/example_11_16.sce
@@ -0,0 +1,13 @@
+//solving the block diagram.. we have GH=k*(s+2)/s^2
+s=poly(0,'s');
+F=syslin('c',[k*(s+2)/(s^2)])
+
+x=2*tan(50*%pi/180) //50 = 180 + atan((x/2)) - 180
+disp(x,"omegaGC = ")
+
+k=(x^2)/sqrt(4+x^2) // |k|*sqrt(4+x^2)/(x^2) = 1
+disp(k,"for PM=50 K is ")
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+
diff --git a/257/CH11/EX11.17/example_11_17.sce b/257/CH11/EX11.17/example_11_17.sce
new file mode 100644
index 000000000..2e9f6a3bb
--- /dev/null
+++ b/257/CH11/EX11.17/example_11_17.sce
@@ -0,0 +1,23 @@
+s=poly(0,'s');
+F=syslin('c',[10*(s*0.5+1)/((1+0.25*s)*s*(0.2*s+1))])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+if(GainMargin>0 & PhaseMargin>0 )
+ disp("stable system")
+else
+ disp("unstable system")
+end
diff --git a/257/CH11/EX11.18/example_11_18.sce b/257/CH11/EX11.18/example_11_18.sce
new file mode 100644
index 000000000..e53d295b6
--- /dev/null
+++ b/257/CH11/EX11.18/example_11_18.sce
@@ -0,0 +1,23 @@
+s=poly(0,'s');
+F=syslin('c',[4/((1+s)^3)])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+if(GainMargin>0 & PhaseMargin>0 )
+ disp("stable system")
+else
+ disp("unstable system")
+end
diff --git a/257/CH11/EX11.19/example_11_19.sce b/257/CH11/EX11.19/example_11_19.sce
new file mode 100644
index 000000000..4f72c3976
--- /dev/null
+++ b/257/CH11/EX11.19/example_11_19.sce
@@ -0,0 +1,26 @@
+//there exists one zero at the origin
+s=%s
+c=-20*log10(2) //at w=2, y=20*log(w)+c becomes this
+k=10.^(c/20)
+
+wc1=10.^((20-c)/20) //20=20*log10(wc1)-c
+y1=poly([1 1/wc1],'s','coeff')
+
+wc2=50
+y2=poly([1 1/wc2],'s','coeff')
+
+wc3=300
+y3=poly([1 1/wc3],'s','coeff')
+
+c2=20+20*log10(50) //equation b/w 50 and 300 is y=-20*log(w)+c2. this is at w=50.
+y=-20*log10(wc3)+c2
+
+c1=y-20*log10(wc3) // for slope with 20dB
+
+wc4=10.^((30-c1)/(20)) // 30=20*log(wc4)+c1
+y4=poly([1 1/wc4],'s','coeff')
+
+y5=poly([0 1],'s','coeff') //zero at origin
+
+TF= (k*(y5)*(y3^2))/((y1)*(y2)*(y4))
+disp(TF, "transfer fuction = ")
diff --git a/257/CH11/EX11.2/example_11_2.sce b/257/CH11/EX11.2/example_11_2.sce
new file mode 100644
index 000000000..9311e38cf
--- /dev/null
+++ b/257/CH11/EX11.2/example_11_2.sce
@@ -0,0 +1,24 @@
+s=poly(0,'s');
+F=syslin('c',[80/((2+s)*s*(s+20))])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+if(GainMargin>0 & PhaseMargin>0 )
+ disp("stable system")
+else
+ disp("unstable system")
+end
diff --git a/257/CH11/EX11.20/example_11_20.sce b/257/CH11/EX11.20/example_11_20.sce
new file mode 100644
index 000000000..23ff5493b
--- /dev/null
+++ b/257/CH11/EX11.20/example_11_20.sce
@@ -0,0 +1,11 @@
+s=poly(0,'s');
+F=syslin('c',[200/((100+12*s+s^2)*s)])
+
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+
diff --git a/257/CH11/EX11.21/example_11_21.sce b/257/CH11/EX11.21/example_11_21.sce
new file mode 100644
index 000000000..897b351bd
--- /dev/null
+++ b/257/CH11/EX11.21/example_11_21.sce
@@ -0,0 +1,24 @@
+s=poly(0,'s');
+F=syslin('c',[k/((1+0.2*s)*s*(0.05*s+1))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+k= 10^(26/20)
+disp(k,"k marginal = ")
+
+// for GM=10 dB, the point on the plot without k is 16dB away from 0dB line.
+k1=10^(16/20) // 20*log(k1)=-10
+disp(k1,"k for GM=10 is ")
+
+
+// for PM=40degrees, the point on the magnitude plot without k is 12dB away from 0dB line.
+k2=10^(12/20) // 20*log(k1)= 6 dB
+disp(k2,"for PM=40degrees k is ")
diff --git a/257/CH11/EX11.22/example_11_22.sce b/257/CH11/EX11.22/example_11_22.sce
new file mode 100644
index 000000000..c7fbb67d6
--- /dev/null
+++ b/257/CH11/EX11.22/example_11_22.sce
@@ -0,0 +1,15 @@
+y=poly([0 1],'s','coeff') //pole at origin
+
+c=20+20*log10(5) //at w=5, y=20
+k=10.^(c/20) //at w=1, y=c
+
+wc1=5 //given
+y1=poly([1 1/wc1],'s','coeff')
+
+c1=20+40*log10(5) // second line is y=-40*log(w)+c1 . this is at w=5.
+
+wc2= 10.^((-40-c1)/(-40))
+y2=poly([1 1/wc2],'s','coeff')
+
+TF= k*y2/(y*y1)
+disp(TF,"transfer function = ") \ No newline at end of file
diff --git a/257/CH11/EX11.23/example_11_23.sce b/257/CH11/EX11.23/example_11_23.sce
new file mode 100644
index 000000000..1f8344570
--- /dev/null
+++ b/257/CH11/EX11.23/example_11_23.sce
@@ -0,0 +1,20 @@
+s=poly(0,'s');
+F=syslin('c',[1/((1+s*0.02)*s*(0.05*s+1))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+// for GM=10 dB, the point on the plot without k is 26dB away from 0dB line.
+k1=10^(26/20) // 20*log(k1)=26
+disp(k1,"k for GM=30 is ")
+F1=syslin('c',[(k1)/((1+s*0.02)*s*(0.05*s+1))])
+
+[PhaseMargin,freqPM]=p_margin(F1)
+disp(PhaseMargin,"PM=")
diff --git a/257/CH11/EX11.24/example_11_24.sce b/257/CH11/EX11.24/example_11_24.sce
new file mode 100644
index 000000000..9be2dedf9
--- /dev/null
+++ b/257/CH11/EX11.24/example_11_24.sce
@@ -0,0 +1,29 @@
+// 6dB/octave = 20dB/decade
+
+wc1=2
+y1=poly([1 1/wc1],'s','coeff')
+
+//to find k
+c1=60+40*log10(4) //y=-40*log(w)+c1
+Y2=-40*log10(2)+c1 //at w=2
+
+c2=Y2+20*log10(2) // y= -20*log(2)+c2
+Y1=-20*log10(1)+c2 //at w=1
+disp(Y1)
+k=10.^(Y1/20)
+
+wc2=10.^((36-c1)/(-40)) //from graph
+y2=poly([1 1/wc2],'s','coeff')
+
+c3=36+60*log10(wc2) //equation of line with sloe -60dB
+wc3=10.^((-18-c3)/(-60))
+y3=poly([1 1/wc3],'s','coeff')
+
+c4= -18+20*log10(wc3)
+wc4=10.^(-54-c4)/(-20)
+y4=poly([1 1/wc4],'s','coeff')
+y5=poly([0 1],'s','coeff') // pole at origin
+
+TF=(k*y3^2)/((y1)*(y2)*(y5)*(y4))
+disp(TF, "TF = ")
+
diff --git a/257/CH11/EX11.25/example_11_25.sce b/257/CH11/EX11.25/example_11_25.sce
new file mode 100644
index 000000000..532d5db46
--- /dev/null
+++ b/257/CH11/EX11.25/example_11_25.sce
@@ -0,0 +1,20 @@
+s=poly(0,'s');
+F=syslin('c',[1/((1+0.001*s)*(s*0.1+1)*(0.25*s+1))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+// for PM=40degrees, the point on the magnitude plot without k is 8dB away from 0dB line.
+k2=10^(8/20) // 20*log(k1)= 8 dB
+disp(k2,"for PM=40degrees k is ")
+F2=syslin('c',[(k2)/((1+0.001*s)*(s*0.1+1)*(0.25*s+1))])
+
+[GainMargin,freqGM]=g_margin(F2)
+disp(GainMargin,"GM=") \ No newline at end of file
diff --git a/257/CH11/EX11.26/example_11_26.sce b/257/CH11/EX11.26/example_11_26.sce
new file mode 100644
index 000000000..155a7d534
--- /dev/null
+++ b/257/CH11/EX11.26/example_11_26.sce
@@ -0,0 +1,19 @@
+s=poly(0,'s');
+F=syslin('c',[80000/((2+s)*s*(s+50)*(s+200))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
diff --git a/257/CH11/EX11.27/example_11_27.sce b/257/CH11/EX11.27/example_11_27.sce
new file mode 100644
index 000000000..92fedf2f6
--- /dev/null
+++ b/257/CH11/EX11.27/example_11_27.sce
@@ -0,0 +1,21 @@
+s=poly(0,'s');
+F=syslin('c',[1/((121+13*s+s^2)*s)]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+// for GM=12 dB, the point on the plot without k is 119.5dB away from 0dB line.
+k1=10^(52/20) // 20*log(k1)=52
+disp(k1,"k=")
+F1=syslin('c',[(k1)/((121+13*s+s^2)*s)])
+
+[PhaseMargin,freqPM]=p_margin(F1)
+disp(PhaseMargin,"PM=")
+
diff --git a/257/CH11/EX11.3/example_11_3.sce b/257/CH11/EX11.3/example_11_3.sce
new file mode 100644
index 000000000..ab5e52ebf
--- /dev/null
+++ b/257/CH11/EX11.3/example_11_3.sce
@@ -0,0 +1,21 @@
+//there is no pole or zero at the origin as the slope is initially 0
+
+wc1=1
+y1=poly([1 1 ],'s','coeff');
+
+// mag at wc2 is -20 and wc1 is 0. hence wc1 and wc2 are a decade apart.
+
+wc2=10
+y2=poly([1 1/wc2 ],'s','coeff');
+disp(y2)
+
+// mag at wc2 is -20 and at w=1000 is 0. hence wc2 and wc3 are decade apart.
+
+wc3=100
+y3=poly([1 1/wc3 ],'s','coeff');
+
+wc4=1000 //given
+y4=poly([1 1/wc4 ],'s','coeff');
+
+TF= (y2*y3)/(y1*y4)
+disp(TF,"transfer function = ")
diff --git a/257/CH11/EX11.4/example_11_4.sce b/257/CH11/EX11.4/example_11_4.sce
new file mode 100644
index 000000000..11a67a367
--- /dev/null
+++ b/257/CH11/EX11.4/example_11_4.sce
@@ -0,0 +1,15 @@
+s=poly(0,'s');
+F=syslin('c',[242*(s+5)/((1+s)*s*(s^2+5*s+121))])
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
diff --git a/257/CH11/EX11.5/example_11_5.sce b/257/CH11/EX11.5/example_11_5.sce
new file mode 100644
index 000000000..979edfc80
--- /dev/null
+++ b/257/CH11/EX11.5/example_11_5.sce
@@ -0,0 +1,24 @@
+s=poly(0,'s');
+F=syslin('c',[1/((2+s)*s*(s+10))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+//we have to make omegaPC=omegaGC. the required upward shift is 22dB
+k1=10^(22/20) // 20*log(k1)=22
+disp(20*k1,"k marginal = ")
diff --git a/257/CH11/EX11.6/example_11_6.sce b/257/CH11/EX11.6/example_11_6.sce
new file mode 100644
index 000000000..c1c54a362
--- /dev/null
+++ b/257/CH11/EX11.6/example_11_6.sce
@@ -0,0 +1,28 @@
+//there is no pole or zero at the origin as the slope is initially 0
+
+w=1 //given
+y1=poly([1 1/w ],'s','coeff');
+
+disp("at wc1 equation is 15=20*log(wc1)") //at wc1, magnitude is 15
+wc1=10^(15/20)
+disp(wc1,"hence wc1=")
+y2=poly([1 1/wc1],'s','coeff')
+
+disp("equation of 2nd line is y= (-20*log(w))+c")
+
+k1=poly([-20*3 0],'c','coeff'); //at w=1000
+c=-k1
+disp(c, "where c is")
+wc2=10^(45/20)
+disp(wc2,"hence wc2 is")
+y3=poly([1 1/wc2],'s','coeff')
+
+wc3=1000 //given
+y4= poly([1 1/wc3],'s','coeff')
+
+TF=y1*y4/(y2*y3)
+disp(TF,"transfer function is")
+
+
+
+
diff --git a/257/CH11/EX11.7/example_11_7.sce b/257/CH11/EX11.7/example_11_7.sce
new file mode 100644
index 000000000..858626f39
--- /dev/null
+++ b/257/CH11/EX11.7/example_11_7.sce
@@ -0,0 +1,28 @@
+s=poly(0,'s');
+F=syslin('c',[1/((1+0.5*s)*s*(s*0.2+1))])
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+disp("without including k")
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND K FOR GM=6dB
+
+k= 10^(6/20) //20*logk=6
+disp(k,"k for GM=6 is")
+
+// TO FIND K FOR PM=25 degrees
+
+k= 10^(6/20) //20*logk=6
+disp(k,"k for PM=25 degrees is") \ No newline at end of file
diff --git a/257/CH11/EX11.8/example_11_8.sce b/257/CH11/EX11.8/example_11_8.sce
new file mode 100644
index 000000000..b76badfe2
--- /dev/null
+++ b/257/CH11/EX11.8/example_11_8.sce
@@ -0,0 +1,51 @@
+// 6dB/octave=20 dB/decade
+
+y1=poly([0 0 1],'s','coeff'); //zero at origin for initial slope
+
+wc1=0.5
+y2=poly([1 1/wc1],'s','coeff')
+
+wc2=1
+y3=poly([1 1/wc2],'s','coeff')
+
+wc3=5
+y4=poly([1 1/wc3],'s','coeff')
+
+//to find k
+
+disp("equation at w=0.5 is y=20*Log(w)+c")
+k1=poly([32-20*log10(1) 0],'s','coeff') // at w=1 32=20*log(1)+c
+
+disp(k1,"where c is ")
+
+k=poly([32+20*log10(0.5) 0],'s','coeff') //magnitude at w=0.5
+
+disp("equation of initial line is y=40*(log(w)+c1)")
+k2=poly([26-40*log10(0.5) 0],'c','coeff') // at w=1 32=20*log(1)+c
+c1=k2
+disp(c1,"where c1 is ")
+
+//now the initial line must have magnitude zero at w=1 for k=1.but at w=1; magnitude is k3 as below, which is due to 'k'
+k3=poly([40*log10(1)+26-40*log10(0.5) 0],'c','coeff')
+
+k=10^((40*log10(1)+26-40*log10(0.5))/(20))
+
+TF= k*(y1)/((y2)*(y3)*(y4))
+disp(TF,"transfer function = ")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/257/CH11/EX11.9/example_11_9.sce b/257/CH11/EX11.9/example_11_9.sce
new file mode 100644
index 000000000..66e94c233
--- /dev/null
+++ b/257/CH11/EX11.9/example_11_9.sce
@@ -0,0 +1,24 @@
+s=poly(0,'s');
+F=syslin('c',[(s^2)/((1+0.2*s)*(0.02*s+1))]) //without k
+
+fmin=0.1; //Min freq in Hz
+fmax=20; //Max freq in Hz
+
+scf(1);clf;
+bode(F,fmin,fmax); //Plots frequency response of open-loop system in Bode diagram
+
+[GainMargin,freqGM]=g_margin(F) //Calculates gain margin [dB] and corresponding frequency [Hz]
+disp(GainMargin,"GM=")
+disp(freqGM*2*3.14,"omegaPC=")
+
+[PhaseMargin,freqPM]=p_margin(F) //Calculates phase [deg] and corresponding freq [Hz] of phase margin
+disp(PhaseMargin,"PM=")
+disp(freqPM*2*3.14,"omegaGC")
+
+show_margins(F) //display gain and phase margin and associated crossover frequencies
+
+// TO FIND VALUE OF K
+
+// at omega=5, the point on the plot without k 28dB away from 0dB line.
+k1=10^(-28/20) // 20*log(k1)=-28
+disp(k1,"k for omegaGC=5 is ")