diff options
author | Siddharth Agarwal | 2019-09-03 18:27:40 +0530 |
---|---|---|
committer | Siddharth Agarwal | 2019-09-03 18:27:40 +0530 |
commit | 8ac15bc5efafa2afc053c293152605b0e6ae60ff (patch) | |
tree | e1bc17aae137922b1ee990f17aae4a6cb15b7d87 /Working_Examples/83/CH14/EX14.2/example_14_2.sce | |
parent | 52a477ec613900885e29c4a0b02806a415b4f83a (diff) | |
download | Xcos_block_examples-master.tar.gz Xcos_block_examples-master.tar.bz2 Xcos_block_examples-master.zip |
Diffstat (limited to 'Working_Examples/83/CH14/EX14.2/example_14_2.sce')
-rwxr-xr-x | Working_Examples/83/CH14/EX14.2/example_14_2.sce | 30 |
1 files changed, 30 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 |