Signal Processing Toolbox™ provides a number of functions that resample a signal at a higher or lower rate.
Operation | Function |
---|---|
Apply FIR filter with resampling | |
Cubic spline interpolation | |
Decimation | |
Interpolation | |
Other 1-D interpolation | |
Resample at new rate |
For examples, see
resample
FunctionThe resample
function changes the sample rate for a sequence to any rate
that is proportional to the original by 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 sample 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 sample rate to another, such as from 48 kHz (the digital audio tape standard) to 44.1 kHz (the compact disc standard). See Convert from DAT Rate to CD Sample Rate for an example.
resample
applies a lowpass filter to the input sequence to prevent
aliasing during resampling. The function designs this filter using the firls
function with a Kaiser window. You can control the filter
length and the beta parameter of the Kaiser window. Alternatively, you can use the
function intfilt
to design an interpolation
filter.
decimate
and interp
FunctionsThe decimate
and interp
functions are equivalent to resample
with p
= 1
and
q
= 1
, respectively. These functions
provide different antialiasing filtering options, and they incur a slight signal
delay due to filtering.
upfirdn
FunctionThe 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
FunctionThe standard MATLAB® environment contains a function, spline
, that works with irregularly spaced
data. The function interp1
performs
interpolation, or table lookup, using various methods including linear
and cubic interpolation.