**CIGAL Reference Manual, Chapter 3 (Functions): interpolate** ===== Interpolate -- Calculate intermediate values based on a standard curve ===== **usage: y = interpolate(x,stdx,stdy,flag)** INTERPOLATE uses a standard curve, defined by the two arrays STDX and STDY, which convert a third set of values, X, to output values Y. The conversion involves first finding the STDX values on either side of each X value (or the two nearest values if X is outside the range of STDX). The Y values are then generated based on the STDY values corresponding to those nearest STDX values. INTERPOLATE normally does a linear local interpolation of Y values based on a standard curve that need not be linear. This type of interpolation can be modified by using the FLAG option as: FLAG: 0 - linear interpolation (default) 1 - set Y2 to the STDY value corresponding to the closest STDX value that is at or below X2 2 - set Y2 to the STDX value corresponding to the closest STDX value that is at or below X2 3 - do a cubic spline interpolation instead of a simple linear interpolation 4 - fill Y2 with linearly increasing values (e.g. 0,1,2,...) with the counting base reset to the STDY value each time the X value crosses one of the STDX values The length of the arrays STDX and STDY must be the same. The number of Y output values generated will be the same as the number of X input values. **See Also:**\\ [[jvs:cigal:manual:chapter2:spline|SPLINE(2)]] [[jvs:cigal|CIGAL Home]], [[jvs:cigal:manual|CIGAL Manual]], [[jvs:cigal:manual:chapter3|Functions List]], [[jvs:cigal:manual:help|Manual Help]]