summaryrefslogtreecommitdiff
path: root/Working_Examples/83/CH14/EX14.2
diff options
context:
space:
mode:
authorSiddharth Agarwal2019-09-03 18:27:40 +0530
committerSiddharth Agarwal2019-09-03 18:27:40 +0530
commit8ac15bc5efafa2afc053c293152605b0e6ae60ff (patch)
treee1bc17aae137922b1ee990f17aae4a6cb15b7d87 /Working_Examples/83/CH14/EX14.2
parent52a477ec613900885e29c4a0b02806a415b4f83a (diff)
downloadXcos_block_examples-master.tar.gz
Xcos_block_examples-master.tar.bz2
Xcos_block_examples-master.zip
Xcos examples from textbooks and for blocksHEADmaster
Diffstat (limited to 'Working_Examples/83/CH14/EX14.2')
-rwxr-xr-xWorking_Examples/83/CH14/EX14.2/example_14_2.sce30
-rwxr-xr-xWorking_Examples/83/CH14/EX14.2/result_example_14_2.txt36
2 files changed, 66 insertions, 0 deletions
diff --git a/Working_Examples/83/CH14/EX14.2/example_14_2.sce b/Working_Examples/83/CH14/EX14.2/example_14_2.sce
new file mode 100755
index 0000000..6d7b95d
--- /dev/null
+++ b/Working_Examples/83/CH14/EX14.2/example_14_2.sce
@@ -0,0 +1,30 @@
+//Chapter 14
+//Example 14.2
+//page 534
+//To estimate the values of the random variables x1 and x2 using WLSE
+clear;clc;
+
+w=diag([0.1;1;0.1]); //assumed matrix
+H=[1 0;0 1;1 1]; //given matrix
+k=inv(H'*w*H)*H'*w; // from eq 14.12b
+y=['y1';'y2';'y3'];
+Px=k*k';
+k=string(k);
+x=[k(1,1)+y(1,1)+k(1,2)+y(2,1)+"+"+k(1,3)+y(3,1) ;k(2,1)+y(1,1)+"+"+k(2,2)+y(2,1)+"+"+k(2,3)+y(3,1)];
+printf('The weighted least square s estimate of the vector x =\n');
+disp(x);
+printf('\n\nThe matrix k is in this case found to be \n');
+disp(k);
+//covariance of measurement is assumed is assumed to be unit matrix
+printf('\n\nThe covariance of the estimation error is obtained as Px=\n');
+disp(Px);
+
+printf('\n\n\n Now choosing W=1\n');
+w=diag([1;1;1]); //assumed matrix
+H=[1 0;0 1;1 1]; //given matrix
+k=inv(H'*w*H)*H'*w; // from eq 14.12b
+Px=k*k';
+printf('\n\nThe matrix k is in this case found to be \n');
+disp(k);
+printf('\n\nThe covariance of the estimation error is obtained as Px=\n');
+disp(Px); \ No newline at end of file
diff --git a/Working_Examples/83/CH14/EX14.2/result_example_14_2.txt b/Working_Examples/83/CH14/EX14.2/result_example_14_2.txt
new file mode 100755
index 0000000..71f30e6
--- /dev/null
+++ b/Working_Examples/83/CH14/EX14.2/result_example_14_2.txt
@@ -0,0 +1,36 @@
+
+The weighted least square s estimate of the vector x =
+
+!0.5238095y1-0.4761905y2+0.4761905y3 !
+! !
+!-0.0476190y1+0.9523810y2+0.0476190y3 !
+
+
+The matrix k is in this case found to be
+
+!0.5238095 -0.4761905 0.4761905 !
+! !
+!-0.0476190 0.9523810 0.0476190 !
+
+
+The covariance of the estimation error is obtained as Px=
+
+ 0.7278912 - 0.4557823
+ - 0.4557823 0.9115646
+
+
+
+ Now choosing W=1
+
+
+The matrix k is in this case found to be
+
+ 0.6666667 - 0.3333333 0.3333333
+ - 0.3333333 0.6666667 0.3333333
+
+
+The covariance of the estimation error is obtained as Px=
+
+ 0.6666667 - 0.3333333
+ - 0.3333333 0.6666667
+