Difference between revisions of "LinearInterp"
m (adding doc status category) |
|||
Line 2: | Line 2: | ||
[[Category:Doc Status C]] <!-- For Lumina use, do not change --> | [[Category:Doc Status C]] <!-- For Lumina use, do not change --> | ||
− | + | = LinearInterp(d,r,x'',I'') = | |
− | ( | + | Uses linear interpolation to determine the value of a piecewise linear function at ''x''. The piecewise curve is determined from a set of points, ''(d,r)'' indexed by ''I'', which represent the vertices of the curve. (Think of ''d'' as the domain, or horizontal axis, and ''r'' as the range, or vertical axis, when thinking about these points). The array ''d'' must be strictly increasing. |
− | = | + | [[LinearInterp]] finds two two points in ''d'' that x lands between -- i.e., |
+ | :''d[@I=j] <= x <= d[@I=j+1]'' | ||
+ | and then interpolates between the two points ''(d[@I=j],r[@I=j])'' and ''(d[@I=j+1],r[@I=j+1])'' for that value of ''x''. You can pass an array of values in for ''x'' to find many points on the curve at once. | ||
− | + | For values of ''x'' landing to the left or right of all points, [[LinearInterp]] extrapolates by assuming the function is a constant value, equal to the leftmost or rightmost value in ''r''. | |
+ | |||
+ | For release 4.1.1 or earlier, the parameters must be strictly numeric. For releases after this, ''d'' and ''r'' may contain [[Null]] values, in which case these points are ignored, with the interpolating occurring only between non-null points. Also, when ''x'' is null or when there are no non-null data points, the result is ''null''. | ||
+ | |||
+ | = Library = | ||
+ | |||
+ | Array functions | ||
= See Also = | = See Also = |
Revision as of 23:46, 11 August 2008
LinearInterp(d,r,x,I)
Uses linear interpolation to determine the value of a piecewise linear function at x. The piecewise curve is determined from a set of points, (d,r) indexed by I, which represent the vertices of the curve. (Think of d as the domain, or horizontal axis, and r as the range, or vertical axis, when thinking about these points). The array d must be strictly increasing.
LinearInterp finds two two points in d that x lands between -- i.e.,
- d[@I=j] <= x <= d[@I=j+1]
and then interpolates between the two points (d[@I=j],r[@I=j]) and (d[@I=j+1],r[@I=j+1]) for that value of x. You can pass an array of values in for x to find many points on the curve at once.
For values of x landing to the left or right of all points, LinearInterp extrapolates by assuming the function is a constant value, equal to the leftmost or rightmost value in r.
For release 4.1.1 or earlier, the parameters must be strictly numeric. For releases after this, d and r may contain Null values, in which case these points are ignored, with the interpolating occurring only between non-null points. Also, when x is null or when there are no non-null data points, the result is null.
Library
Array functions
Enable comment auto-refresher