%% $Date: 2012-07-06 17:42:54#$
%% $Revision: 149 $
\index{interpolate\_linear}
\algdesc{Linear Interpolation (old)}
{ %%%%%% Algorithm name %%%%%%
interpolate\_linear\_old
}
{ %%%%%% Algorithm summary %%%%%%
This algorithm linearly interpolates a variable piecewise from one coordinate system to another. All values 
are interpolated, even if they exist in the new coordinate system.
}
{%%%%%% Category %%%%%%%
Transforms
}  
{ %%%%%% Inputs %%%%%%
$x$ & Vector & x-coordinates of the data points (must be increasing). \\
$f$ & Vector & Data points to interpolate. \\
$x_{interp}$ & Vector & New set of x-coordinates to use in interpolation. \\
$f_{left}$ & Coeff, optional & Value to return when $x_{interp} < x_0$. Default is $f_0$.\\
$f_{right}$ & Coeff, optional & Value to return when $x_{interp} > x_n$. Default is $f_n$.
}
{ %%%%%% Outputs %%%%%%
$f_{interp}$ & Vector & Interpolated values of $f$.
}
{ %%%%%% Formula %%%%%%
For each value of $x_{interp}$ the two surrounding points are found and designated $x_a$ and $x_b$, with 
corresponding values $f_a$ and $f_b$. Then $f_{interp}$ is calculated piecewise as follows:

\begin{displaymath}
 f_{interp}[i] = f_a + (x_{interp}[i] - x_a) \frac{f_b - f_a}{x_b - x_a}
\end{displaymath}

Values where $x_{interp}$ is less than $x_0$ are replaced with $f_{left}$, if provided, or $f_0$.
Likewise, $f_{right}$ if given, or $f_n$ are substituted where $x_{interp}$ is greater than $x_n$. 

}
{ %%%%%% Author %%%%%%

}
{ %%%%%% References %%%%%% 

}


