summaryrefslogtreecommitdiff
path: root/122/CH2/EX2.b.4
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /122/CH2/EX2.b.4
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '122/CH2/EX2.b.4')
-rwxr-xr-x122/CH2/EX2.b.4/excB_2_4.sce56
-rwxr-xr-x122/CH2/EX2.b.4/figB2_4.jpgbin0 -> 54004 bytes
2 files changed, 56 insertions, 0 deletions
diff --git a/122/CH2/EX2.b.4/excB_2_4.sce b/122/CH2/EX2.b.4/excB_2_4.sce
new file mode 100755
index 000000000..f43fca5e6
--- /dev/null
+++ b/122/CH2/EX2.b.4/excB_2_4.sce
@@ -0,0 +1,56 @@
+// Exercise B-2-4
+// Plotting the response of different types of controllers
+// to unit step and unit ramp input.
+
+clear; clc; xdel(winsid());
+
+Kp = 4; //proportional gain
+Ki1 = 2; //integral gain
+Td = 0.8; //differential time
+Ti = 2; //integral time
+Ki2 = Kp / Ti;
+
+s = %s;
+Gi = syslin('c',Ki1/s);
+
+t = 0:0.05:3;
+ramp = t;
+subplot(3,2,1);
+p1 = Kp * ones(1,length(t));
+p2 = Kp * t;
+plot2d(t ,p1 , style=2);
+plot2d(t ,p2 , style=3);
+xtitle('Proportional control','t','y');
+legend('step input','ramp input');
+xgrid(color('gray'));
+
+subplot(3,2,2);
+i1 = csim("step",t,Gi);
+i2 = csim(ramp,t,Gi);
+plot2d(t ,i1, style=2);
+plot2d(t ,i2, style=3) ;
+xtitle('Integral control','t','y');
+xgrid(color('gray'));
+i1 = i1 * Ki2 / Ki1; //change of gain
+i2 = i2 * Ki2 / Ki1;
+
+
+subplot(3,2,3);
+plot2d(t ,p1 + i1, style=2);
+plot2d(t ,p2 + i2, style=3);
+xtitle('Proportional integral control','t','y');
+xgrid(color('gray'));
+
+subplot(3,2,4);
+pd1 = p1;
+pd2 = p2 + Kp*Td*ones(1,length(t)); //derivative term
+plot2d(t ,pd1, style=2);
+plot2d(t ,pd2, style=3);
+xtitle('Proportional plus derivative control','t','y');
+xgrid(color('gray'));
+
+subplot(3,2,5);
+plot2d(t ,pd1 + i1, style=2);
+plot2d(t ,pd2 + i2, style=3,leg='ramp input') ;
+xtitle('P.I.D. control','t','y');
+xgrid(color('gray'));
diff --git a/122/CH2/EX2.b.4/figB2_4.jpg b/122/CH2/EX2.b.4/figB2_4.jpg
new file mode 100755
index 000000000..2bc5dc63c
--- /dev/null
+++ b/122/CH2/EX2.b.4/figB2_4.jpg
Binary files differ