This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Available Resampling Functions

The toolbox provides a number of functions that resample a signal at a higher or lower rate.



Apply FIR filter with resampling


Cubic spline interpolation






Other 1-D interpolation


Resample at new rate


resample Function

The resample function changes the sampling rate for a sequence to any rate that is a ratio of two integers. The basic syntax for resample is

y = resample(x,p,q)

where the function resamples the sequence x at p/q times the original sampling rate. The length of the result y is p/q times the length of x.

One resampling application is the conversion of digitized audio signals from one sampling rate to another, such as from 48 kHz (the digital audio tape standard) to 44.1 kHz (the compact disc standard).

The example file contains a length 4001 vector of speech sampled at 7418 Hz:

load mtlb
Name         Size            Bytes  Class     Attributes

Fs           1x1                 8  double              
mtlb      4001x1             32008  double
Fs =


To play this speech signal on a workstation that can only play sound at 8192 Hz, use the rat function to find integers p and q that yield the correct resampling factor:

[p,q] = rat(8192/Fs,0.0001)
p =
q =

Since p/q*Fs = 8192.05 Hz, the tolerance of 0.0001 is acceptable; to resample the signal at very close to 8192 Hz:

y = resample(mtlb,p,q);

resample applies a lowpass filter to the input sequence to prevent aliasing during resampling. It designs this filter using the firls function with a Kaiser window. The syntax


controls the filter's length and the beta parameter of the Kaiser window. Alternatively, use the function intfilt to design an interpolation filter b and use it with


decimate and interp Functions

The decimate and interp functions do the same thing as resample with p = 1 and q = 1, respectively. These functions provide different anti-alias filtering options, and they incur a slight signal delay due to filtering. The interp function is significantly less efficient than the resample function with q = 1.

upfirdn Function

The toolbox also contains a function, upfirdn, that applies an FIR filter to an input sequence and outputs the filtered sequence at a sample rate different than its original. See Multirate Filter Bank Implementation.

spline Function

The standard MATLAB® environment contains a function, spline, that works with irregularly spaced data. The MATLAB function interp1 performs interpolation, or table lookup, using various methods including linear and cubic interpolation.

Was this topic helpful?