## Code for Figure 2.3

### main.m

```%% Copyright (C) 2001, James B. Rawlings and John G. Ekerdt
%%
%% This program is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License as
%% published by the Free Software Foundation; either version 2, or (at
%% your option) any later version.
%%
%% This program is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%% General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; see the file COPYING.  If not, write to
%% the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
%% MA 02111-1307, USA.

%
% rate_estimation.m
%
stoi=[0 1 0 -1 -1 1; -1 1 1 -1 0 0; 1 0 -1 0 -1 1];
r=[1;2];
A=stoi(1:2,:);
R=A'*r;
%
% set seed for "reproducible" random numbers
%
randn('seed',0)
%
% lots of noisy points
%
npoints=500;
Rmeas = zeros (6, npoints);
for i=1:npoints
Rmeas(:,i)=0.05*randn(6,1)+R;
end
rest=(inv(A*A')*A * Rmeas)';
save_precision(5);
save -text rate_estimation_lots.dat rest;
plot (rest(:,1), rest(:,2), '+');
axis ([.8, 1.2, 1.8, 2.2]);
title ('Figure 2.3')
```

## Data files

### rate_estimation_lots.dat

```# Created by Octave 3.6.1, Tue Apr 17 09:58:34 2012 CDT
# name: rest
# type: matrix
# rows: 500
# columns: 2
0.96862 2.006
1.0017 2.0074
0.96238 2.0387
0.99388 1.9819
0.96849 2.0064
1.0093 1.9616
0.99073 2.0251
0.92004 2.0611
0.95971 2.0435
1.0254 2.0451
1.0111 2.0148
0.96381 2.038
1.012 2.001
1.0014 1.9348
1.0023 1.9998
1.0005 1.9799
1.0314 1.996
1.0404 2.0185
0.99698 2.0114
0.99787 2.0119
0.95679 2.0088
0.9902 1.9707
1.023 1.9985
0.99459 1.9409
0.96718 1.9976
1.0115 1.9701
1.0099 1.9957
0.97868 2.021
0.99287 1.9792
0.99896 2.0411
0.97188 2.0005
1.0195 1.9801
1.0038 1.9574
0.98154 2.0194
1.0151 1.9558
0.95731 2.0165
0.95841 2.0259
0.98101 2.0137
0.97379 1.9889
1.0289 2.0109
0.99916 2.0387
1.0076 2.0249
1.0092 2.0209
1.0146 2.001
0.99344 2.0188
0.96673 2.0018
1.0076 1.9893
0.98285 1.9852
0.94054 2.0109
1.0004 2.0139
1.0266 2.0035
0.95806 2.0327
1.0121 1.9811
1.0034 1.9508
1.0084 2.016
1.0508 1.9591
1.0386 1.9922
0.98848 2.0042
0.97984 1.9991
0.97308 2.0186
1.0061 1.9767
1.0834 1.9652
1.0049 2.0041
1.0374 1.9785
1.0229 2.0008
0.99038 1.9921
0.98962 1.9577
1.0007 2.0195
1.0044 2.0046
1.0116 1.9831
0.97631 2.0051
0.99099 2.0154
0.9658 1.9795
0.9809 1.9875
0.9812 1.9891
1.0001 1.9979
1.0108 1.9639
0.95207 2.0281
0.9993 2.0202
1.0266 1.9956
1.0273 1.9535
0.91022 2.0435
0.98616 2.0438
1.0027 1.9774
1.0193 2.0368
1.0484 1.9679
1.0744 2.0076
0.99587 2.0067
1.0282 1.9881
1.0132 1.9671
0.97064 2.0098
1.0007 1.9914
0.97152 1.9854
1.0501 1.9906
1.0305 1.9573
1.0141 1.9878
1.0549 1.9243
0.99486 2.0069
1.0002 1.9392
0.95386 2.0553
0.96659 1.9856
1.0125 1.9978
0.94819 2.0357
1.0062 2.0065
0.97585 2.0382
1.0456 1.9264
1.0007 1.986
1.0415 1.9799
1.0053 2.0047
1.0225 1.9855
1.0104 1.9879
0.99994 2.0236
0.98139 2.0179
1.0529 1.9764
0.93149 2.0753
1.0416 2.0163
0.98607 2.0082
0.97929 1.9963
0.95738 1.9886
1.0076 2.0381
1.0152 1.9763
1.0709 1.9713
1.0158 1.9926
0.98769 1.9899
1.0112 2.0244
1.0487 1.9632
1.002 2.0489
0.93994 2.018
1.0182 2.0415
0.98809 2.0311
1.0287 1.9506
1.002 1.964
0.96895 2.0333
1.0165 1.9721
0.96771 2.0557
1.0121 2.0194
1.0403 2.0101
0.98916 1.9955
0.99316 1.995
0.99774 2.0048
0.97636 1.9804
0.973 2.0251
0.99437 2.0023
0.9914 1.9819
0.97502 2.0341
0.96717 2.0336
1.0375 1.991
0.99084 2.0257
1.0232 1.986
1.0043 1.9935
1.0015 1.9962
0.99426 1.9492
0.99126 1.9947
1.0104 2.0337
0.97895 2.0237
1.0171 2.0483
0.97353 2.0315
0.97787 1.994
1.0008 1.9908
0.96326 2.0017
0.97787 1.9586
0.99672 1.9485
1.0326 1.9798
1.0037 1.9843
0.99134 2.0154
0.9918 2.0222
0.98418 2.022
0.97318 2.0204
0.99835 1.9865
1.0363 2.0247
0.98263 1.964
0.94796 2.0305
0.97533 1.997
1.0371 2.0035
1.0377 1.9787
0.98866 1.9826
1.0536 2.0007
1.0274 1.9673
0.9945 2.0185
0.98117 2.0057
1.0059 2.0271
0.98613 2.0125
0.99772 1.9969
0.99868 1.9713
0.95696 2.0717
1.0023 2.0082
1.0031 1.9808
0.95918 2.0316
1.0246 1.9578
0.96823 1.9889
1.0388 2.0114
0.9721 2.0462
0.99314 1.9564
0.95073 2.028
1.0103 2.0435
1.0369 1.978
1.02 2.0263
1.0104 2.0257
0.97202 2.0098
1.036 1.9829
1.0041 2.0539
0.96583 2.0068
1.0042 2.0228
0.98548 2.026
1.009 1.9672
1.0233 1.993
1.0117 2.013
1.0348 1.972
0.99764 1.9663
1.0504 1.9574
0.9865 1.9732
0.98164 2.0201
0.97767 2.0302
1.0375 1.9834
0.98002 2.0025
1.005 1.9866
1.0284 1.9828
1.03 1.9886
0.97179 2.0295
0.96156 2.011
1.0086 1.9498
1.0137 1.9582
1.0555 1.9502
0.99239 2.0061
1.0067 1.9409
1.0128 1.983
0.98038 2.0069
1.013 1.9534
1.0276 2.0024
0.9929 1.9736
1.0258 1.9839
0.96726 2.0342
1.0326 1.9692
0.9991 2.0009
1.0393 1.9933
0.98007 1.9987
0.99123 1.9731
0.98879 1.9875
1.0098 2.0547
1.0417 1.9974
0.96469 1.9957
0.99963 2.0004
1.0178 2.0057
0.95121 2.056
1.0007 1.969
1.0358 1.9603
1.0171 2.0042
0.99506 2.0063
0.99291 2.012
0.92962 2.003
1.0212 2.0287
1.0012 1.941
0.99471 2.0045
0.98796 1.9909
0.98023 2.0041
1.0325 2.0444
0.97524 2.0406
0.96507 2.0251
0.99847 2.0133
1.0239 2.0233
0.95976 2.0317
0.99572 2.0238
0.95235 2.0465
1.0224 1.9883
0.98724 2.0324
1.0198 2.007
0.99204 2.0461
0.99206 1.9713
0.99914 1.9851
1.0233 2.0282
1.0114 1.9962
0.95997 2.0014
0.98722 2.0273
0.9962 2.0192
1.0239 1.9736
0.96623 1.9902
1.0088 1.9733
1.0676 1.9442
1.0113 2.0274
1.002 1.9823
1.0002 2.0042
1.0252 2.0306
0.9808 1.9776
0.96848 2.0155
0.98079 1.9943
0.9923 2.0104
1.0176 2.0027
0.98789 2.0135
0.98344 2.0168
0.99534 2.0149
1.0089 2.0042
0.97745 1.9901
0.95379 2.0221
1.004 2.0135
1.005 2.0303
0.99935 2.0698
1.013 1.9964
1.026 2.0338
1.0302 2.0005
0.97008 2.0524
0.97969 2.0175
1.0069 1.9671
0.9873 1.9959
1.0078 1.9745
1.0019 1.9546
0.96983 2.0122
1.0325 1.9908
0.99567 2.0134
1.0103 2.0256
0.95785 2.0472
1.0048 2.032
0.97547 2.0537
1.0169 2.0137
0.99875 1.9677
1.0077 1.9297
0.98744 1.9896
1.0336 1.9785
0.94493 2.0697
1.0241 2.023
0.97456 2.0394
1.0169 1.9528
0.97881 2.0386
0.97353 2.0417
1.0299 1.9786
1.0053 1.9951
0.94826 2.0267
1.0276 2.013
0.94734 2.0178
0.99231 1.9821
0.97034 2.0231
1.018 2.014
0.98003 1.9732
1.0213 2.0057
1.0334 2.0288
0.99014 2.0226
1.0192 1.9654
0.99528 2.0205
1.0376 1.9355
0.98877 2.0442
0.99514 2.0333
1.04 2.0022
1.0371 1.9812
1.0367 2.0377
0.98249 2.0646
0.99125 1.9877
0.99838 1.9785
0.91504 2.0509
0.95513 2.0174
0.98565 1.9719
0.94881 2.0082
0.9305 2.0464
0.9985 2
0.98194 1.981
1.0234 1.9898
1.0034 1.9765
0.97686 2.0284
0.962 1.9922
0.99753 1.9873
0.9834 2.0131
1.0134 1.9827
0.98273 1.968
0.94405 2.0153
1.0301 1.9576
0.98259 2.0216
0.96819 2.0409
1.0526 1.9848
0.98355 1.9994
0.9718 2.0329
1.0083 1.9838
1.0154 2.0272
0.99452 2.0039
1.0138 2.0158
0.96156 2.0262
1.0311 2.0075
0.97513 1.9898
0.99632 1.9858
1.0013 1.9985
0.95617 2.0437
0.97448 2.0128
1.003 2.0045
0.99825 2.0316
0.97268 2.0367
1.0135 2.0117
1.0194 2.0165
1.0165 2.0087
0.98308 1.9876
0.96884 2.0304
1.0176 2.0605
0.94137 2.0265
1.0037 1.9869
1.0338 1.9747
0.97958 1.9945
0.98541 2.0364
1.0309 1.99
0.98592 2.03
1.0068 2.0103
0.97149 1.9747
0.99903 1.9957
1.024 1.9638
0.93656 2.0304
1.0394 1.9861
1.0747 1.9656
1.0382 2.0225
1.0165 2.0288
0.97177 2.0046
1.0084 2.0144
0.98487 1.988
0.99914 1.9751
1.0094 1.9954
0.97498 2.0222
1.014 1.9931
1.013 2.0367
0.96957 2.0234
0.95246 2.0287
1.033 1.9899
1.0236 1.9864
1.0399 1.9694
1.0025 1.9698
1.0055 1.9695
0.99568 2.0265
0.96844 1.9712
0.97506 2.022
0.99245 1.9929
1.0033 2.0248
0.97365 2.0501
0.95591 2.0117
1.0438 1.9847
1.0186 2.0415
1.0076 2.0304
0.96203 2.0405
1.0313 1.9537
1.0034 1.9967
1.0095 1.9789
0.98332 2.0216
0.99586 1.9583
0.99221 1.9891
0.96738 1.9732
0.97113 1.967
0.98155 1.9744
0.99606 1.9723
0.99404 2.0103
0.97124 2.0433
0.9995 1.9946
0.9964 2.0126
1.0206 1.9949
1.0615 1.9683
1.0222 1.9606
1.0635 1.9766
0.97511 2.0224
0.96072 2.0064
1.015 2.0416
1.045 1.9998
1.0122 1.9947
0.99949 1.9834
0.98237 2.0385
1.0578 1.9522
1.0282 2.0007
1.0105 1.979
0.99872 1.9699
0.9936 1.9919
0.963 2.0121
1.0131 2.0133
0.93664 2.057
1.0138 2.0092
0.96838 1.9663
1.0434 1.9743
1.0191 1.9809
1.0362 1.9502
0.95827 2.007
1.0151 2.0303
0.99607 2.0258
0.98823 1.9935
0.98465 2.0194
0.99767 1.988
1.0209 1.9757
1.0009 2.0134
0.96494 2.0144
1.0284 1.9568
1.0332 1.9587
0.99923 1.9904
1.004 1.9922
0.91355 2.0387
1.0004 1.9647
0.9869 1.9917
0.97492 2.0061
0.96523 2.0391
1.0343 1.9777
0.97955 1.9827
0.95202 1.9905
0.96025 2.036
1.0173 1.9731
0.99173 1.9963
1.0484 1.9838
0.96988 2.0108
0.96074 2.0515
0.9903 2.0027
1.0194 1.9868
0.9958 2.0321
1.0219 2.0066
1.0709 1.9301

```