summaryrefslogtreecommitdiff
path: root/122/CH2/EX2.a.7/exaA_2_7.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /122/CH2/EX2.a.7/exaA_2_7.sce
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 '122/CH2/EX2.a.7/exaA_2_7.sce')
-rwxr-xr-x122/CH2/EX2.a.7/exaA_2_7.sce23
1 files changed, 23 insertions, 0 deletions
diff --git a/122/CH2/EX2.a.7/exaA_2_7.sce b/122/CH2/EX2.a.7/exaA_2_7.sce
new file mode 100755
index 000000000..392d82378
--- /dev/null
+++ b/122/CH2/EX2.a.7/exaA_2_7.sce
@@ -0,0 +1,23 @@
+// Example A-2-7
+// Transfer function to controllable form (state space)
+
+clear; clc;close;mode(0);
+
+s = %s;
+Num = 2*s^3 + s^2 + s + 2; n = coeff(Num);
+Den = s^3 + 4*s^2 + 5*s + 2; d = coeff(Den);
+for i = 1:4 ; b(i) = n(5 - i); a(i) = d(5 - i); end
+
+// Method 1
+_beta(1) = b(1);
+_beta(2) = b(2) - a(2)*_beta(1);
+_beta(3) = b(3) - a(2)*_beta(2) - a(3)*_beta(1);
+_beta(4) = b(4) - a(2)*_beta(3) - a(3)*_beta(2) - a(4)*_beta(1);
+
+A = [0 1 0; 0 0 1; -d(1:3)]
+B = _beta(2:4)
+C = [1 0 0 ]
+D = b(1)
+
+// method 2
+H2 = cont_frm(Num,Den)