Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Lookups

LOOKUP SLOPE(lookup,x,m) Find the SLOPE of LOOKUP

Scroll Prev Top Next More

Finds the slope at x in the lookup lookup  according to the mode m.  Between points on a Lookup the slope is just the change in y divided by the change in x from one point to the next.  If x is the same as a point in lookup then the average of the slope before and after x is returned, unless there is more than one point with that x value in which case :NA: is returned.

If the value for x is outside the domain of lookup (bigger than the biggest x point or smaller than the smallest x point) what is returned depends on m,  If m is 0 then 0 is returned, this is analogous to a normal lookup.  If m is 1 then the slope of the closes segment is used (this is analogous to LOOKUP EXTRAPOLATE).  If m is -1 then :NA: is returned.  

Units: LOOKUP SLOPE(units,dmnl,dmnl) --> units

Example

LOOK((0,1),(1,1),(2,3))

LOOKUP SLOPE(LOOK,-1,-1) is equal to :NA:

LOOKUP SLOPE(LOOK,-1,0) is equal to 0

LOOKUP SLOPE(LOOK,-1,1) is equal to 1

LOOKUP SLOPE(LOOK,1,0) is equal to .75

LOOKUP SLOPE(LOOK,0.5,0) is equal to 1

LOOKUP SLOPE(LOOK,1.5,0) is equal to .5

Availability: Not PLE or PLE Plus

See also: LOOKUP AREA, VECTOR LOOKUP, Lookups

Sample model: LOOKUP functions.mdl in FunctionExamples