diff options
Diffstat (limited to 'Working_Examples/3432/CH2')
-rwxr-xr-x | Working_Examples/3432/CH2/EX2.1.b/DEPENDENCIES/fig_settings.sci | 9 | ||||
-rwxr-xr-x | Working_Examples/3432/CH2/EX2.1.b/Ex2_1.sce | 30 | ||||
-rwxr-xr-x | Working_Examples/3432/CH2/EX2.1.b/Ex2_1_f0.pdf | bin | 0 -> 17708 bytes | |||
-rwxr-xr-x | Working_Examples/3432/CH2/EX2.5.b/DEPENDENCIES/fig_settings.sci | 9 | ||||
-rwxr-xr-x | Working_Examples/3432/CH2/EX2.5.b/Ex2_5.sce | 30 | ||||
-rwxr-xr-x | Working_Examples/3432/CH2/EX2.5.b/Ex2_5_f0.pdf | bin | 0 -> 26693 bytes |
6 files changed, 78 insertions, 0 deletions
diff --git a/Working_Examples/3432/CH2/EX2.1.b/DEPENDENCIES/fig_settings.sci b/Working_Examples/3432/CH2/EX2.1.b/DEPENDENCIES/fig_settings.sci new file mode 100755 index 0000000..5d5e7d4 --- /dev/null +++ b/Working_Examples/3432/CH2/EX2.1.b/DEPENDENCIES/fig_settings.sci @@ -0,0 +1,9 @@ +//------------------------------------------------------------------
+//figure handel settings
+f=get("current_figure"); //Current figure handle
+f.background=8; //make the figure window background white
+l=f.children(1);
+l.background=8 ;//make the text background white
+id=color('grey');
+xgrid(id);
+//------------------------------------------------------------------
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)
+
+//------------------------------------------------------------------
diff --git a/Working_Examples/3432/CH2/EX2.1.b/Ex2_1_f0.pdf b/Working_Examples/3432/CH2/EX2.1.b/Ex2_1_f0.pdf Binary files differnew file mode 100755 index 0000000..d687229 --- /dev/null +++ b/Working_Examples/3432/CH2/EX2.1.b/Ex2_1_f0.pdf diff --git a/Working_Examples/3432/CH2/EX2.5.b/DEPENDENCIES/fig_settings.sci b/Working_Examples/3432/CH2/EX2.5.b/DEPENDENCIES/fig_settings.sci new file mode 100755 index 0000000..5d5e7d4 --- /dev/null +++ b/Working_Examples/3432/CH2/EX2.5.b/DEPENDENCIES/fig_settings.sci @@ -0,0 +1,9 @@ +//------------------------------------------------------------------
+//figure handel settings
+f=get("current_figure"); //Current figure handle
+f.background=8; //make the figure window background white
+l=f.children(1);
+l.background=8 ;//make the text background white
+id=color('grey');
+xgrid(id);
+//------------------------------------------------------------------
diff --git a/Working_Examples/3432/CH2/EX2.5.b/Ex2_5.sce b/Working_Examples/3432/CH2/EX2.5.b/Ex2_5.sce new file mode 100755 index 0000000..b4b48e3 --- /dev/null +++ b/Working_Examples/3432/CH2/EX2.5.b/Ex2_5.sce @@ -0,0 +1,30 @@ +//Example 2.5
+//(b) step response of pendulum
+
+xdel(winsid())//close all graphics Windows
+clear;
+clc;
+
+//------------------------------------------------------------------
+//Pendulum parameters
+m=0.5;
+l=1;
+g=9.81;
+
+// Transfer function
+s=%s;
+sys=syslin('c',(1/(m*l^2))/(s^2+g/l));
+
+//step response to u=500;
+t=0:0.02:10;
+theta=csim('step',t,sys);
+plot(t,theta*57.3);
+
+//Title, labels and grid to the figure
+exec .\fig_settings.sci; // custom script to set figure properties
+title('Response of pendulum to a step input in the applied torque',...
+'fontsize',3);
+xlabel('Time t (sec.)','fontsize',2);
+ylabel('Pendulum angle (degree)','fontsize',2);
+
+//------------------------------------------------------------------
diff --git a/Working_Examples/3432/CH2/EX2.5.b/Ex2_5_f0.pdf b/Working_Examples/3432/CH2/EX2.5.b/Ex2_5_f0.pdf Binary files differnew file mode 100755 index 0000000..b396fb5 --- /dev/null +++ b/Working_Examples/3432/CH2/EX2.5.b/Ex2_5_f0.pdf |