interp1q
(Not recommended) Quick 1-D interpolation
interp1q
is not recommended. Use interp1
instead.
Syntax
Description
Examples
Linear Interpolation Using interp1q
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)
Input Arguments
x
— Sample points
column vector
Sample points, specified as a monotonically increasing column vector. The sample
points in x
are the x-coordinates of the sample
data in Y
.
Example: [1; 2; 3; 4]
Example: [1.1; 2.4; 3.2; 4.7]
Data Types: single
| double
Complex Number Support: Yes
Y
— Sample data
column vector | matrix
Sample data, specified as a column vector or matrix. The sample data in
Y
represents function values at the coordinates in
x
.
If
Y
is a column vector, then it must havelength(x)
elements. The length of outputyi
is equal tolength(xi)
.If
Y
is a matrix, then it must havelength(x)
rows and the interpolation is performed for each column ofY
. In that case, the size ofyi
islength(xi)
-by-size(Y,2)
.
Example: [1; 4; 9; 16]
Example: [0.1; 1.4; 2.2; 3.7]
Data Types: single
| double
Complex Number Support: Yes
xi
— Query points
column vector
Query points, specified as a column vector. The query points are locations where
interp1q
uses linear interpolation to determine the approximate
value of the function represented by Y
.
interp1q
returns NaN
for any values of
xi
that lie outside the coordinates in x
.
Example: [1.5; 2.5]
Data Types: single
| double
Complex Number Support: Yes
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Results might not match MATLAB® when some
Y
values areInf
orNaN
.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced before R2006a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)