Page 253 - Compact Numerical Methods For Computers
P. 253

240               Compact numerical methods for computers
                            Example 19.2. Surveying-data fitting
                            The output below illustrates the solution of a linear least-squares problem of the
                            type described in example 2.4. No weighting of the observations is employed here,
                            though in practice one would probably weight each height-difference observation
                            by some factor inversely related to the distance of the observation position from
                            the points whose height difference is measured. The problem given here was
                            generated by artificially perturbing the differences between the heights b=
                                            T
                            (0, 100, 121, 96) . The quantities G printed are the residuals of the normal
                            equations.
                                             RUN
                                             SURVEYING LEAST SQUARES
                                             # OF POINTS? 4
                                             # OF OBSERVATIONS? 5
                                             HEIGHT DIFF BETWEEN? 1 AND? 2=? -99.99
                                             HEIGHT DIFF BETWEEN? 2 AND? 3=? -21.03
                                             HEIGHT DIFF BETWEEN? 3 AND? 4=? 24.98
                                             HEIGHT DIFF BETWEEN? 1 AND? 3=? -121.02
                                             HEIGHT DIFF BETWEEN? 2 AND? 4=? 3.99
                                             B( 1 )=-79.2575 G= 2.61738E-6
                                             B( 2 )= 20.7375 G=-2.26933E-6
                                             B( 3 )= 41.7575 G=-6.05617E-6
                                             B( 4 )= 16.7625 G=-5.73596E-6
                                             DIFF( 1 )=-99.995
                                             DIFF( 2 )=-21.02
                                             DIFF( 3 )= 24.995
                                             DIFF( 4 )=-121.015
                                             DIFF( 5 )= 3.97501
                                             # MATRIX PRODUCTS= 4
                                             HEIGHT FORM B(1)=0
                                             2               99.995
                                             3               121.015
                                             4               96.02
                              The software diskette contains the data file EX24LSl.CNM which, used with the driver
                            DR24LS.PAS, will execute this example.


                              As a test of the method of conjugate gradients (algorithm 24) in solving
                            least-squares problems of the above type, a number of examples were generated
                            using all possible combinations of n heights. These heights were produced using a
                            pseudo-random-number generator which produces numbers in the interval (0,1).
                            All  m=n*(n-1)/2 height differences were then computed and perturbed by
                            pseudo-random values formed from the output of the above-mentioned generator
                            minus 0·5 scaled to some range externally specified. Therefore if S1 is the scale
                            factor for the heights and S2 the scale factor for the perturbation and the function
                            RND(X) gives a number in (0,1), heights are computed using
                                                           S1*RND(X)

                            and perturbations on the height differences using
                                                       S2*[RND(X)-0·51.
                            Table 19.2 gives a summary of these calculations. It is important that the
   248   249   250   251   252   253   254   255   256   257   258