Learn R Programming

OptHedging (version 1.0)

interpol1d: Linear interpolation function.

Description

Interpolates linearly a function given at equally spaced points on the interval [minS,maxS].

Usage

interpol1d(x,F0,minS,maxS)

Arguments

x
Point at which the function is interpolated.
minS
Minimum value of the grid.
maxS
Maximum value of the grid.
F0
Value of the function at m equally spaced points on the grid.

Value

interpol
Linear interpolation of the function at point x.

References

Chapter 3 of 'Statistical Methods for Financial Engineering, B. Remillard, CRC Press, (2013).

Examples

Run this code
F0 = c(1:10)
minS = 1;
maxS = 10;
out = interpol1d(2.45,F0,1,10)
out #since the function is the identity, the answer should be 2.45!

Run the code above in your browser using DataLab