summaryrefslogtreecommitdiff
path: root/2048/CH2
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /2048/CH2
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 '2048/CH2')
-rwxr-xr-x2048/CH2/EX2.1/pend_model.sce33
-rwxr-xr-x2048/CH2/EX2.2/mat_exp.sce5
-rwxr-xr-x2048/CH2/EX2.3/ZOH1.sce13
3 files changed, 51 insertions, 0 deletions
diff --git a/2048/CH2/EX2.1/pend_model.sce b/2048/CH2/EX2.1/pend_model.sce
new file mode 100755
index 000000000..1181fc69f
--- /dev/null
+++ b/2048/CH2/EX2.1/pend_model.sce
@@ -0,0 +1,33 @@
+// Model of inverted pendulum
+// 2.1
+
+Km = 0.00767;
+Kg = 3.7;
+Rm = 2.6;
+r = 0.00635;
+M = 0.522;
+m = 0.231;
+g = 9.81;
+L = 0.305;
+J = 0;
+
+D1 = (J+m*L^2)*(M+m)-m^2*L^2;
+alpha = m*g*L*(M+m)/D1;
+beta1 = m*L/D1;
+gamma1 = m^2*g*L^2/D1;
+delta = (J+m*L^2)/D1;
+
+alpha1 = Km*Kg/Rm/r;
+alpha2 = Km^2*Kg^2/Rm/r^2;
+
+A = zeros(4,4);
+A(1,3) = 1;
+A(2,4) = 1;
+A(3,2) = -gamma1;
+A(3,3) = -alpha2*delta;
+A(4,2) = alpha;
+A(4,3) = alpha2*beta1;
+
+B = zeros(4,1);
+B(3) = alpha1*delta;
+B(4) = -alpha1*beta1;
diff --git a/2048/CH2/EX2.2/mat_exp.sce b/2048/CH2/EX2.2/mat_exp.sce
new file mode 100755
index 000000000..9127e89db
--- /dev/null
+++ b/2048/CH2/EX2.2/mat_exp.sce
@@ -0,0 +1,5 @@
+// Exponential of the matrix
+// 2.2
+
+F = [-1 0;1 0];
+expm(F)
diff --git a/2048/CH2/EX2.3/ZOH1.sce b/2048/CH2/EX2.3/ZOH1.sce
new file mode 100755
index 000000000..f48504f34
--- /dev/null
+++ b/2048/CH2/EX2.3/ZOH1.sce
@@ -0,0 +1,13 @@
+// ZOH equivalent state space system
+// 2.3
+
+F = [-1 0;1 0]; G = [1; 0];
+C = [0 1]; D = 0; Ts=1;
+sys = syslin('c',F,G,C,D);
+sysd = dscr(sys,Ts)
+
+
+
+
+
+