jagomart
digital resources
picture1_Thermal Analysis Pdf 87449 | Least Squares Analysis And Curve Fitting


 164x       Filetype PDF       File size 0.22 MB       Source: chetaero.files.wordpress.com


File: Thermal Analysis Pdf 87449 | Least Squares Analysis And Curve Fitting
this document downloaded from vulcanhammer net vulcanhammer info chet aero marine don t forget to visit our companion site http www vulcanhammer org use subject to the terms and conditions ...

icon picture PDF Filetype PDF | Posted on 14 Sep 2022 | 3 years ago
Partial capture of text on file.
           This document downloaded from 
    vulcanhammer.net    vulcanhammer.info 
                     Chet Aero Marine
       Don’t forget to visit our companion site 
            http://www.vulcanhammer.org
                   Use subject to the terms and conditions of the respective websites.
               Fluid Mechanics Laboratory                                                                                            ©DonC.Warrington
               ENCE3070L                                                                                                        http://chetaero.wordpress.com
                                           Least Squares Analysis and Curve Fitting
                                                                     DonC.Warrington
                                                      Departments of Civil and Mechanical Engineering
                                                            University of Tennessee at Chattanooga
                                    Thisisabriefoverviewofleastsquaresanalysis. Itbeginsbyexplainingthedifferencebetween
                                    interplation and least squares analysis using basic linear algebra. From there vector norms and
                                    their relationship with the residual is discussed. Non-linear regression, such as is used with
                                    exponential and power regression, is explained. Finally a worked example is used to show the
                                    various regression schemes applied to a data set.
                                    Keywords: least squares, regression, residuals, linear algebra, logarithmic plotting
                                        Introduction                                  We know we can define a line using two points. Work-
                  Curve fitting–particularly linear “curve” fitting–is a well        ing in two dimensions, we can write these two equations as
               knowntechniqueamongengineersandscientists. In the past              follows:
               the technique was generally applied graphically, i.e., the en-
               gineerorscientistwouldplotthepointsandthendrawa“best                                       y    = mx +b                          (2)
               fit” line among the points, taking into consideration outliers,                               1          1
                                                                                                          y    = mx +b
               etc.                                                                                         2          2
                  In reality, curve fitting is a mathematical technique which
               involves the solution of multiple equations, invoking the use          In matrix form, this is
               of linear algebra and statistical considerations. This is the                                               
               way a spreadsheet would look at the problem, and students                              x     1  m       y   
                                                                                                        1                1 
                                                                                                                           
                                                                                                                    =                     (3)
               and practitioners alike utilize this tool without really under-                                             
                                                                                                      x     1  b       y   
               standing how they do their job. That understanding, how-                                  2                    2
               ever, can be critical; numerical methods, while capable of             Wecanalsowritethis as
               excellent results, can also veer into poor ones without much
               warning. Avoiding problems such as this requires that the                            x     1  m       y   
                                                                                                      1               1 
                                                                                                                         
                                                                                                                         
               engineer look at the results before he or she uses them.                                           −       = 0             (4)
                                                                                                                         
                                                                                                    x     1  b       y   
                  Thisisabriefintroductiontothesubject. Hereweattempt                                  2                   2
               to present the concepts in a way which utilizes basic concepts
               to understand some relatively advanced ones. Many presen-              which will become handy shortly.
               tations get lost in the theory, and the students are likewise          Equation 3 is easy to solve; we can invert the matrix thus:
               lost; we attempt to avoid this here.
                                                                                                                 −1              −1 
                                                                                                        (x − x )      −(x −x )       
                                                                                                          1    2          1    2     
                                                                                                 −1                                  
                                                                                                                                     
                                   Linear Interpolation                                         A =                                           (5)
                                                                                                                                     
                                                                                                          − x2              x1       
                                                                                                             x −x           x −x
                  Let us begin by considering the equation of a line, thus                                    1  2          1  2
                                                                                      Wethenpremultiply the right hand side of Equation 3 by
                                         y = mx+b                          (1)     this to obtain
                  It’s worth stopping here and noting that there are only two                                      y −y    
                                                                                                         m          1 2    
                                                                                                                   x1−x2   
               mathematical operations going one here: addition and scalar                                                 
                                                                                                                           
                                                                                                             =                              (6)
                                                                                                                           
                                                                                                                  x y −x y   
               multiplication. In linear algebra, a vector space is defined                                b          1 2 2 1
               as a set where all the elements are either sums of two ele-                                            x1−x2
               ments, scalar multiples of two elements, or a combination of           From this we can compute the slope m and y-intercept b.
               both(Gelfand(1961).) Thusthissimpleequationisanexcel-               Weshould also note that the line passes through both points
               lent illustration of the connection between linear algebra–to       perfectly; this is the physical meaning of Equation 4. This is
               which we will have recourse–and basic graphical concepts.           illustrated in Figure 1. In this case m = 2, b = 1.
                                                                                1
              2                                                        WARRINGTON
                                                                                 This would result in a second-order equation that would
                                                                              pass through the three points. We could keep expanding this
                                                                              withanincreasingnumberofpoints,althoughthereareprac-
                                                                              tical limits. This is true interpolation: the curve that results
                                                                              passes through all of the points. Doing this is illustrated in 3,
                                                                              with the equation that results from this type of interpolation.
              Figure 1. Two-Point Interpolation
              AddingPoints
                 Nowletusconsider the situation where we have three (3)
              points. Equation 3 then becomes
                                x    1           y                        Figure 3. Second-Order Polynomial Interpolation
                                 1               1 
                                                     
                                                     
                                        m          
                                                   
                                                   
                                                                           There are many applications for true interpolation; the
                                x    1       =  y                (7)
                                 2               2 
                                                     
                                                     
                                          b                               best known(albeit invisible to the user) are the Bézier curves
                                x    1           y   
                                  3                   3                       and cubic splines that are used in programs such as Adobe
                 The matrix-vector multiplication is fine, but we can’t in-    Photoshop®.
              vert the matrix on the left hand side. What we have here is a      Thesecondwayistodosomethingthatstudentsarealltoo
              situationwhere,foralinearsolution,wehaveoverdefinedthe           familiar with: cheat. Experimental data is subject to many
              problem: we have more equations than we have unknowns.          variations in instrumentation and data collection to the point
              This situation is illustrated in Figure 2.                      that, dependinguponthesituation,tryingtocorrelatethedata
                                                                              to some kind of simple expression neither warrants nor de-
                                                                              serves the use of anything more than a linear expression. In
                                                                              this case we can use Equation 7, but with the caveat that that
                                                                              we’re not looking for the unique solution of the equation but
                                                                              the best solution, i.e., one where the line we generate comes
                                                                              closest to the points without necessarily passing through any
                                                                              of them.
                                                                                 Westart this process as we did before, by rewriting Equa-
                                                                              tion 7 as
                                                                                            x   1            y          
                                                                                             1              1 
                                                                                                                
                                                                                                                    r   
                                                                                                    m              1 
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                            x   1       −  y   =  r           (10)
              Figure 2. Three Data Points                                                    2              2      2 
                                                                                                                        
                                                                                                                        
                                                                                                      b         
                                                                                                                     r
                                                                                             x   1              y         3
                 So what is to be done? We have two choices. The first is                      3                  3
              to “square up” the matrix on the left hand side of Equation 7,     First note: for more than three data points, we simply ex-
              which would allow us to solve the problem in the same way       pand the number of rows in both the matrix and the y vector,
              as we had with Equation 3. We could define a new “line”          both being the same. Beyond that, unlike Equation 4, the
              (it’s actually a parabola) as follows:                          right hand side is nonzero. This is a residual; our goal is to
                                                                              comeupwithvaluesofmandbthatminimizethatresidual.
                                   y = nx2 + mx + b                    (8)
                                                                              Vector Norms
                 In this case, Equation 7 becomes                                But what does it mean to minimize a vector, which has
                                                  y                     morethanonescalar? Atthispoint we introduce the concept
                                2                      1 
                                                         
                             x    x1   1  n          
                               1                     
                                                                        of a vector norm, which is best explained using illustrations.
                               2                     
                                                     
                             x    x    1  m  =  y                (9)
                               2    2              2 
                                                                        Theidea of a vector norm is to express the “size” of a vector
                               2                     
                                                         
                               x   x3   1     b          
                                3                      y                      in a scalar form.
                                                        3
                                                                                                                                     LEASTSQUARESANALYSIS                                                                                                                                   3
                                  Before we start, it’s worth noting that the values of r can                                                                           What we want to do is to find the values of b and m so
                            be positive, negative, or zero. We’re normally (sorry!) not                                                                           that Equation 13 is minimized. We can skip the square root
                            interested in the sign of these vector entries; we will only                                                                          operation; the result will be the same and it only complicates
                            consider them in a positive way. There is more than one                                                                               the differentiation. To accomplish this we take two partial
                            way to define these norms; the methods we show here can                                                                                differentials:
                            be found in Gourdin and Boumahrat (1989).
                                  One way would be to simply add up the absolute values                                                                                                                           ∂Pr2
                            of the entries of the norm. This is referred to as the 1-norm,                                                                                                                            ∂b            = 0                                               (16)
                            given by the equation                                                                                                                                                                 ∂Pr2
                                                                                                 n                                                                                                                                  = 0
                                                                             krk = X|r|                                                         (11)                                                                 ∂m
                                                                                    1                 i                                                                 Doing the summations and differentiations yields
                                                                                             i=1
                                  Another way would be to minimize the entry with the
                            largest absolute value. This is referred to as the infinity norm,                                                                                                                             n             n
                                                                                                                                                                                                    nb          +mPx −Py                              =0                              (17)
                            or                                                                                                                                                                                                 i             i
                                                                                                                                                                                                                       i=1            i=1
                                                                                                                                                                                                                      n               n
                                                                 krk        =max|r|, 1 ≤ i ≤ n                                                  (12)                                                  b +mPx2−Pxy =0
                                                                       ∞                    i                                                                                                                        i=1 i          i=1 i i
                                  The last one is referred to as the 2-norm or Euclidean                                                                                Solvingthesetwoequationssimultaneouslywillyieldval-
                            norm, given by the equation                                                                                                           ues for b and m. Fortunately this is built into spreadsheets so
                                                                                          v
                                                                                          t n                                                                     explicit calculation is not necessary.
                                                                                               X2                                                                       One quantity you will see frequently with least squares
                                                                           krk =                      r                                         (13)
                                                                                 2                      i                                                                                                                                                             2
                                                                                                i=1                                                               fitting (linear regression) with spreadsheets is R , generally
                                  For two data points, the Euclidean norm is the length of                                                                        referred to as the coefficient of determination. This is gener-
                            the hypotenuse of a triangle with side lengths r and r (the                                                                           ally computed by
                                                                                                                               1             2
                            Pythagorean theorem.) What this physically means for more                                                                                                                                                       2
                                                                                                                                                                                                                                      krk
                            than three dimensions is physically iffy, but the Euclidean                                                                                                                    R2 = 1−                           2                                         (18)
                                                                                                                                                                                                                                n
                            norm is the most commonly used for a wide variety of rea-                                                                                                                                          P(                 )2
                            sons.                                                                                                                                                                                              i=1 yi − y¯
                                                                                                                                                                        where y¯ is the mean of all the values of y. It is a handy
                            Minimizing the Residual                                                                                                               wayofmeasuring the quality of the fit of the data to the line
                                  Nowthatwe’vepresentedvectornorms,we’rereadytodo                                                                                 youhavecomputed. If our goal is to minimize the Euclidean
                                                                                                                                                                                             2
                            something with them. It should be obvious that our goal is                                                                            norm, then R will approach 1 as the fit improves.
                            to minimize the norm of the right hand side of Equation 10                                                                                  Doing this for the example in Figures 2 and 3 is shown in
                            using the definition of Equation 13. But how? One way is                                                                               Figure 4. Although for this data it is not the best way to do
                                                                                                                                                                  this (as evidenced by the low value of R2,) as the number of
                            to employ a technique which students use frequently: guess.                                                                           data points increase (in statistics, the sample size) the value
                            Actually this isn’t as stupid as it sounds, because guessing is                                                                       of this type of least-squares analysis–also known as linear
                            pretty much what drives most non-linear solution and opti-                                                                            regression–increases.
                            mization techniques. The idea is that our guessing scheme
                            is reasonably methodical and grounded in the mathematical
                            reality, which speeds up getting to the answer.
                                  In this case, however, we can skip the guessing, because
                            the solution can be found in “closed form,” as shown by
                            Wylie (1951). Consider Equation 10; the equation for any
                            right-hand side residual is
                                                                         r = mx +b−y                                                            (14)
                                                                           i             i                i
                                  Squaring this per Equation 13 yields
                                                                                                                                                                  Figure 4. Linear Regression Analysis
                                       2           2     2                                                 2                         2
                                     r =m x +2mbx −2mxy +b −2by +y                                                                              (15)
                                       i                i                     i               i  i                         i        i
The words contained in this file might help you see if this file matches what you are looking for:

...This document downloaded from vulcanhammer net info chet aero marine don t forget to visit our companion site http www org use subject the terms and conditions of respective websites fluid mechanics laboratory donc warrington encel chetaero wordpress com least squares analysis curve fitting departments civil mechanical engineering university tennessee at chattanooga thisisabriefoverviewofleastsquaresanalysis itbeginsbyexplainingthedierencebetween interplation using basic linear algebra there vector norms their relationship with residual is discussed non regression such as used exponential power explained finally a worked example show various schemes applied data set keywords residuals logarithmic plotting introduction we know can dene line two points work tting particularly well ing in dimensions write these equations knowntechniqueamongengineersandscientists past follows technique was generally graphically i e en gineerorscientistwouldplotthepointsandthendrawa best y mx b among taking...

no reviews yet
Please Login to review.