diff options
Diffstat (limited to 'Working_Examples/83/CH14')
6 files changed, 118 insertions, 0 deletions
diff --git a/Working_Examples/83/CH14/EX14.1/example_14_1.sce b/Working_Examples/83/CH14/EX14.1/example_14_1.sce new file mode 100755 index 0000000..e392b99 --- /dev/null +++ b/Working_Examples/83/CH14/EX14.1/example_14_1.sce @@ -0,0 +1,13 @@ +//Chapter 14 +//Example 14.1 +//page 533 +//To estimate the values of the random variables x1 and x2 +clear;clc; + +H=[1 0;0 1;1 1]; //given matrix +k=inv(H'*H)*H'; // from eq 14.9 +y=['y1';'y2';'y3']; +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('Estimate of x =\n'); +disp(x);
\ No newline at end of file diff --git a/Working_Examples/83/CH14/EX14.1/result_example_14_1.txt b/Working_Examples/83/CH14/EX14.1/result_example_14_1.txt new file mode 100755 index 0000000..8e301aa --- /dev/null +++ b/Working_Examples/83/CH14/EX14.1/result_example_14_1.txt @@ -0,0 +1,7 @@ + +Estimate of x = + +!0.6666667y1-0.3333333y2+0.3333333y3 ! +! ! +!-0.3333333y1+0.6666667y2+0.3333333y3 ! + 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 + diff --git a/Working_Examples/83/CH14/EX14.3/example_14_3.sce b/Working_Examples/83/CH14/EX14.3/example_14_3.sce new file mode 100755 index 0000000..7b53d0a --- /dev/null +++ b/Working_Examples/83/CH14/EX14.3/example_14_3.sce @@ -0,0 +1,16 @@ +//Chapter 14 +//Example 14.3 +//page 538 +//To estimate the values of the random variables x1 and x2 using WLSE +clear;clc; +i=0; x=1;y=8.5 +printf('---------------------------------------\n'); +printf('iteration\t\tx(l)\n'); +printf('---------------------------------------\n'); +printf('\t%d\t\t%0.3f\n',i,x); +for i=1:1:10 + k=(1/3)*x^-2 //expression for the value of k has been printed wrongly in the textbook + x=x+(k)*(y-x^3); + printf('\t%d\t\t%0.3f\n',i,x); + +end diff --git a/Working_Examples/83/CH14/EX14.3/result_example_14_3.txt b/Working_Examples/83/CH14/EX14.3/result_example_14_3.txt new file mode 100755 index 0000000..2a65a97 --- /dev/null +++ b/Working_Examples/83/CH14/EX14.3/result_example_14_3.txt @@ -0,0 +1,16 @@ + +--------------------------------------- +iteration x(l) +--------------------------------------- + 0 1.000 + 1 3.500 + 2 2.565 + 3 2.141 + 4 2.045 + 5 2.041 + 6 2.041 + 7 2.041 + 8 2.041 + 9 2.041 + 10 2.041 + |