summaryrefslogtreecommitdiff
path: root/Working_Examples/3432/CH2/EX2.5.b
diff options
context:
space:
mode:
Diffstat (limited to 'Working_Examples/3432/CH2/EX2.5.b')
-rwxr-xr-xWorking_Examples/3432/CH2/EX2.5.b/DEPENDENCIES/fig_settings.sci9
-rwxr-xr-xWorking_Examples/3432/CH2/EX2.5.b/Ex2_5.sce30
-rwxr-xr-xWorking_Examples/3432/CH2/EX2.5.b/Ex2_5_f0.pdfbin0 -> 26693 bytes
3 files changed, 39 insertions, 0 deletions
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
new file mode 100755
index 0000000..b396fb5
--- /dev/null
+++ b/Working_Examples/3432/CH2/EX2.5.b/Ex2_5_f0.pdf
Binary files differ