Skip to Main Content Skip to Search
Product Documentation

interp1q - Quick 1-D linear interpolation

Syntax

yi = interp1q(x,Y,xi)

Description

yi = interp1q(x,Y,xi) returns the value of the 1-D function Y at the points of column vector xi using linear interpolation. The vector x specifies the coordinates of the underlying interval. The length of output yi is equal to the length of xi.

interp1q is quicker than interp1 on non-uniformly spaced data because it does no input checking.

For interp1q to work properly,

interp1q returns NaN for any values of xi that lie outside the coordinates in x. If Y is a matrix, then the interpolation is performed for each column of Y, in which case yi is length(xi)-by-size(Y,2).

Examples

Generate a coarse sine curve and interpolate over a finer abscissa.

x = (0:10)'; 
y = sin(x); 
xi = (0:.25:10)'; 
yi = interp1q(x,y,xi); 
plot(x,y,'o',xi,yi)

See Also

interp1 | interp2 | interp3 | interpn

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS