interp1q

Quick linear 1-D interpolation on column data.

Category: Mathematics > Interpolation

Syntax

yi = interp1q(x, Y, xi)

Linearly interpolates the columns of Y sampled at the column vector x, at the points xi.

Description

interp1q is a stripped-down form of interp1: it performs only linear interpolation and expects column vectors with sorted sample points, skipping the input checks that interp1 does.

It is kept for older code. New code should call interp1, which also handles row vectors, other methods and extrapolation.

Input arguments

x
Column vector of increasing sample points.
Y
Column vector or matrix with one row per element of x.
xi
Column vector of query points.

Output arguments

yi
Interpolated values, one row per query point. Points outside x give NaN.

Example

Two query points

x = [1; 2; 3];
y = [10; 20; 40];
interp1q(x, y, [1.5; 2.5])
Output
ans = 2×1

    15
    30

See also

interp1 spline pchip