summaryrefslogtreecommitdiff
path: root/Working_Examples/3432/CH2/EX2.1.b/Ex2_1.sce
diff options
context:
space:
mode:
Diffstat (limited to 'Working_Examples/3432/CH2/EX2.1.b/Ex2_1.sce')
-rwxr-xr-xWorking_Examples/3432/CH2/EX2.1.b/Ex2_1.sce30
1 files changed, 30 insertions, 0 deletions
diff --git a/Working_Examples/3432/CH2/EX2.1.b/Ex2_1.sce b/Working_Examples/3432/CH2/EX2.1.b/Ex2_1.sce
new file mode 100755
index 0000000..7889a68
--- /dev/null
+++ b/Working_Examples/3432/CH2/EX2.1.b/Ex2_1.sce
@@ -0,0 +1,30 @@
+//Example 2.1
+//(b) step response of Cruise control system
+
+xdel(winsid())//close all graphics Windows
+clear;
+clc;
+
+//------------------------------------------------------------------
+//Cruise control parameters
+m=1000;
+b=50;
+u=500;
+
+// Transfer function
+s=%s; // or
+s=poly(0,'s');
+sys=syslin('c',(1/m)/(s+b/m))
+
+//step response to u=500;
+t=0:0.5:100;
+v=csim('step',t,u*sys);
+plot2d(t,v,2)
+
+//Title, labels and grid to the figure
+exec .\fig_settings.sci; //custom script for setting figure properties
+title('Responses of car velocity to a step in u','fontsize',3)
+xlabel('Time t (sec.)','fontsize',2)
+ylabel('Amplitude','fontsize',2)
+
+//------------------------------------------------------------------