Returns the value of a vector at the index for which a paired vector first takes on a specified value. |
||
Syntax |
B = GetPairVal(X, Y, A, Tol) |
|
Arguments |
Name |
Description |
X |
A vector of real numbers. |
|
Y |
A vector of real numbers. |
|
A |
A real number. |
|
Tol (optional) |
Tolerance. A non-negative number that specifies how close a value of X must be to A to be identified as equal. If the tolerance is omitted, the function performs linear interpolation, with the assumption that X is sorted in a strictly ascending order. |
|
Outputs |
Name |
Description |
B |
The value of Y corresponding to X = A. |
|
Example |
For X = [1,2,3,2] and Y = [4,5,6,7], find the first value of Y corresponding to X = 2. |
|
Syntax |
||
B = GetPairVal([1,2,3,2], [4,5,6,7], 2, 0.001) |
||
Results |
||
B = 5 |
||
Comments |
If the value occurs in X at a location beyond the length of Y, an error occurs. If the value does not occur in X, an error occurs. |