summaryrefslogtreecommitdiff
path: root/3889/CH2/EX2.4/Ex2_4.sce
diff options
context:
space:
mode:
Diffstat (limited to '3889/CH2/EX2.4/Ex2_4.sce')
-rw-r--r--3889/CH2/EX2.4/Ex2_4.sce50
1 files changed, 50 insertions, 0 deletions
diff --git a/3889/CH2/EX2.4/Ex2_4.sce b/3889/CH2/EX2.4/Ex2_4.sce
new file mode 100644
index 000000000..00723546e
--- /dev/null
+++ b/3889/CH2/EX2.4/Ex2_4.sce
@@ -0,0 +1,50 @@
+//Example 2.4
+//page 63
+//Control Systems: Principles and Design
+//M Gopal, Second Edition, Tata McGraw-Hill
+//Chapter: Dynamic Models and Dynamic Response
+
+
+xdel(winsid())//close all graphics Windows
+clear;
+clc;
+
+// Transfer function
+s= %s;
+//s=poly(0,'s');
+y=1;
+r=(s^2) + (3*s) + 2;
+//continuous time linear model created
+g=syslin('c',y/r);
+
+clf();
+t=0:0.5:100;
+a=size(t)
+u=ones(a(1),a(2));
+//step response
+y1=csim(u,t,[g*5]);
+
+//ramp response
+u2= 5* t;
+y2=csim(u2,t,g)
+
+//plot
+subplot(211)
+plot(t,y1)
+m=gca();
+m.auto_scale = "off"
+m.data_bounds = [0,0;6,6]
+plot(t,5*u)
+title('Step Response of transfer function','fontsize',3)
+xlabel('Time t (sec.)','fontsize',2)
+ylabel('Amplitude','fontsize',2)
+subplot(212)
+plot(t,y2)
+m=gca();
+m.auto_scale = "off"
+m.data_bounds = [0,0;10,10]
+
+plot(t,u2)
+title('Ramp Response of transfer function','fontsize',3)
+xlabel('Time t (sec.)','fontsize',2)
+ylabel('Amplitude','fontsize',2)