| Signal Processing Toolbox | Search  Help Desk |
| interp | Examples See Also |
Increase sampling rate by an integer factor (interpolation).
Syntax
y = interp(x,r) y = interp(x,r,l,alpha) [y,b] = interp(x,r,l,alpha)
Description
Interpolation increases the original sampling rate for a sequence to a higher rate.interp performs lowpass interpolation by inserting zeros into the original sequence and then applying a special lowpass filter.
y = interp(x,r)
increases the sampling rate of x by a factor of r. The interpolated vector y is r times longer than the original input x.
y = interp(x,r,l,alpha)
specifies l (filter length) and alpha (cut-off frequency). The default value for l is 4 and the default value for alpha is 0.5.
[y,b] = interp(x,r,l,alpha)
returns vector b containing the filter coefficients used for the interpolation.
Example
Interpolate a signal by a factor of four:t = 0:0.001:1; % time vector
x = sin(2*pi*30*t) + sin(2*pi*60*t);
y = interp(x,4);
stem(x(1:30)); title('Original Signal');
figure
stem(y(1:120)); title('Interpolated Signal');
Algorithm
interp uses the lowpass interpolation Algorithm 8.1 described in [1]:
...l*r+1. The number of original sample values used for interpolation is 2*l. Ordinarily, l should be less than or equal to 10. The original signal is assumed to be band limited with normalized cutoff frequency 0 
alpha 
1, where 1 is half the original sampling frequency (the Nyquist frequency). The default value for l is 4 and the default value for alpha is 0.5.
Diagnostics
Ifr is not an integer, interp gives the following error message:
Resampling rate R must be an integer.
See Also
decimate |
Decrease the sampling rate for a sequence (decimation). |
interp1 |
One-dimensional data interpolation (table lookup) (see the online MATLAB Function Reference). |
resample |
Change sampling rate by any rational factor. |
spline |
Cubic spline interpolation (see the online MATLAB Function Reference). |
upfirdn |
Upsample, apply an FIR filter, and downsample. |
References
[1] IEEE. Programs for Digital Signal Processing. IEEE Press. New York: John Wiley & Sons, 1979. Algorithm 8.1.