Difference between revisions of "StepInterp"
(→Notes) |
|||
Line 10: | Line 10: | ||
= Notes = | = Notes = | ||
− | StepInterp uses | + | StepInterp uses "right-lookup", finding a value u in D such that x<=u. In the interpolated graph, this makes the the step up takes place at the left edge of each interval. Sometimes you might want a "left-lookup", finding a value u in D such that u<=x. One implementation of this other variant is a [[User-Defined Functions|UDF]]: |
− | Function | + | Function LStepInterp(D:ascending[I] ; R:Array[I] ; X ; I : Index ) |
Definition: | Definition: | ||
Var pos := StepInterp(D,@I,X,I); | Var pos := StepInterp(D,@I,X,I); |
Revision as of 20:34, 5 October 2007
(stub)
Declaration
StepInterp( D,A,X,I)
Notes
StepInterp uses "right-lookup", finding a value u in D such that x<=u. In the interpolated graph, this makes the the step up takes place at the left edge of each interval. Sometimes you might want a "left-lookup", finding a value u in D such that u<=x. One implementation of this other variant is a UDF:
Function LStepInterp(D:ascending[I] ; R:Array[I] ; X ; I : Index ) Definition: Var pos := StepInterp(D,@I,X,I); R[@I= if X=D[@I=pos] then pos else max([1,pos-1]) ]
See Also
Comments
Enable comment auto-refresher