Page 111 - Excel for Scientists and Engineers: Numerical Methods
P. 111

88                                         EXCEL: NUMERICAL METHODS































                                Figure 5-12.  Four bracketing x values required
                                  to perform cubic interpolation at x = 33.3%.
                    (folder 'Chapter 05 Interpolation', workbook 'Interpolation I', sheet Cubic Interpolation')


                   The Lagrange fourth-order polynomial is cumbersome to use in a worksheet
               function, but convenient to use in the form of a custom function.  A compact and
               elegant implementation of cubic interpolation in the form of an Excel 4.0 Macro
               Language custom function was provided by Orvis'.  A slightly modified version,
               in VBA, is provided  here (Figure 5-13).  The syntax of the custom  function  is
               InterpC(/ookup-value, known-x's,  knownj's). The argument lookup-value  is
               the  value  of  the  independent  variable  for  which  you  want  the  interpolated  y
               value;  known-x's  and  known-y's  are the arrays of independent  and  dependent
               variables,  respectively,  that  comprise  the  table.  The  table  must  be  sorted  in
               ascending order of known-x  8.














               * William J. Orvis, Excel 4for Scientists and Engineers, Sybex Inc., Alameda, CA, 1993.
   106   107   108   109   110   111   112   113   114   115   116