<< CL_interpLagrange Math CL_intervDiff >>

CelestLab >> Math > CL_interpLin

CL_interpLin

Linear interpolation

Calling Sequence

[y] = CL_interpLin(xref,yref,x)

Description

Parameters

xref:

Reference abscissae, sorted in strictly increasing order (1xN)

yref:

Corresponding ordinates (PxN)

x:

Abscissae, where to interpolate (1xM)

y:

Interpolated values (PxM)

Authors

See also

Examples

// Example 1: Exact interpolation
xref = 1:6;
yref = [3*xref; -1+8*xref];
x = 0:0.5:4;

[y] = CL_interpLin(xref, yref, x);
y - [3*x; -1+8*x]

// Example 2: Interpolation of sin and cos
xref = linspace(0,1,101);
yref = [sin(2*%pi*xref); cos(2*%pi*xref)];
x = linspace(0,1,1001);

[y] = CL_interpLin(xref, yref, x);
scf();
plot(x, y - [sin(2*%pi*x); cos(2*%pi*x)]);

Report an issue
<< CL_interpLagrange Math CL_intervDiff >>