Interpolates Y values from a series given arbitrary X values.
XYLOOKUP(series, xi, "method", range)
series |
- |
A series. The input series to interpolate from. |
|||||||||
xi |
- |
A series. The desired output X values. |
|||||||||
"method" |
- |
Optional. A string, the interpolation method.
|
|||||||||
range |
- |
Optional. An integer, the out of range method.
|
XYLOOKUP(xseries, yseries, xi, "method", range)
xseries |
- |
A series. The input X series to interpolate from. |
|||||||||
yseries |
- |
A series. The input Y series to interpolate from. |
|||||||||
xi |
- |
A series. The desired output X values. |
|||||||||
"method" |
- |
Optional. A string, the interpolation method.
|
|||||||||
range |
- |
Optional. An integer, the out of range method.
|
An XY series where the Y values are the interpolated output result.
W1: {1, 2, 3, 2}
W2: xylookup(w1, {0.2, 1.5, 2.4})
W3: W1;overp(w2,lred);setsym(14,2);setplotstyle(1,2)
W1 contains the source series.
W2 linearly interpolates W1 at X = {0.2, 1.5, 2.4} to produce an XY series with Y values of {1.2, 2.5, 2.6}.
W3 displays the original series with the interpolated values overplotted as red circles.
W4: xylookup(w1, {0.2, 1.5, 2.4}, "spline", 1)
Same as above except cubic SPLINE interpolation is performed and out of range values are clipped to the first or last point of W1.
W5: xylookup(xvals(w1), yvals(w1), -1..0.2..4, "spline")
Interpolates W1 over the range -1 to 4 using cubic splines. Explicit X and Y input series are specified.
If the desired X values lie outside the X range of the input series, the resulting output values depend on the range parameter.
If range is 0 or unspecified, out of range output values are computed by applying the interpolation method on the first two or last two points of the input series and extrapolating to the new X value.
If range is 1, out of range output values are set to the first or last point of the input series.
If range is 2, out of range output values are set to NA.
If "method" is "none", out of range values are always clipped to the end point values (same as range == 1).
If xi is a real, the result is a real. In the example above, to return the interpolated Y value at X = 1.5:
yi = xylookup(W1, 1.5)
See RESAMPLE and XYINTERP to interpolate an XY series to an interval series with equally spaced X values.