Contents - Index



The Interpolate function returns an interpolated or extrapolated value from tabular data.  These data can be in a Lookup table in the  Lookup Table Window or a Lookup file (stored on disk).   This function combines the capabilities of the Lookup and LookupRow functions and it is much easier to use.  The format of this function is 


INTERPOLATE('Table Name','ColName1','ColName2',ColName2=Value, FirstRow, LastRow)


'Table Name' is a string constant or string variable  that provides the name of the Lookup table in the Lookup Window or the name of an existing Lookup file stored on disk. The string constant must be enclosed within single quote marks.  Lookup table names appear on the tabs at the top of the Lookup Table Window.   If the name of a disk file is supplied, it must be the name of an existing Lookup file having either the binary or ASCII Lookup file Format.  


ColName1 and ColName2 are the column header names.  These variables must be either be string constants or string variables.  Since there is no ambiguity, the single quotes for string constants are optional.


The next parameter is of the form ColName2=Value where the text to the left of the equal sign can be either of the column header names (ColName1 or ColName2) specified with the two previous parameters.  Note that if a string variable was provided for the column name, then the same string variable must be used for this parameter.  Value is a numerical value or expression.   EES will return the interpolated value from the data in column ColName1 corresponding to the specified value of ColName2.  If the value of ColName1 is supplied, EES will return the interpolated value of ColName2.


FirstRow and LastRow are optional.  If they are not provided, the Interpolate function will use all of the rows in the table.  If FirstRow and LastRow are provided, only the specified range of rows will be used.  If LastRow is set to 0 or a number greater than then number of rows in the table, the Interpolate function will set it to the number of rows in the table.


The Interpolate function uses cubic interpolation and it requires a minimum of five rows.  Related functions are Interpolate1 and Interpolate2 that provide exactly the same capability using linear interpolation and quadratic interpolation, respectively.  Interpolate3, which provides cubic interpolation, is identical the Interpolate function.  The Interpolate2D function provides interpolation as a function of two independent variables. 


EES will issue a warning if the Interpolate function is used to provide extrapolation.  Warnings will not be visible unless the Display Warning Messages control in the Options tab of the Preferences dialog is checked.


(Note:  use a semicolon instead of a comma as the list separator when using the European numerical format).


Note that the data in the specified columns of the table in the specified range of rows must be monotonic, i.e., increasing or decreasing.  The Interpolate function will fail to find a correct result if this is not the case.  


Open file Copper.EES in the EES\Userlib\Examples folder for an example demonstrating the use of this function.


Mathematical Functions