Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Upsample, apply FIR filter, and downsample

`yout = upfirdn(xin,h)`

`yout = upfirdn(xin,h,p)`

`yout = upfirdn(xin,h,p,q)`

The valid combinations of the sizes of `xin`

and `h`

are:

`xin`

is a vector and`h`

is a vector.The inputs are one filter and one signal, so the function convolves

`xin`

with`h`

. The output signal`yout`

is a row vector if`xin`

is a row vector; otherwise,`yout`

is a column vector.`xin`

is a matrix and`h`

is a vector.The inputs are one filter and many signals, so the function convolves

`h`

with each column of`xin`

. The resulting`yout`

is a matrix with the same number of columns as`xin`

.`xin`

is a vector and`h`

is a matrix.The inputs are multiple filters and one signal, so the function convolves each column of

`h`

with`xin`

. The resulting`yout`

is a matrix with the same number of columns as`h`

.`xin`

is a matrix and`h`

is a matrix, both with the same number of columns.The inputs are multiple filters and multiple signals, so the function convolves corresponding columns of

`xin`

and`h`

. The resulting`yout`

is a matrix with the same number of columns as`xin`

and`h`

.

`upfirdn`

uses a polyphase interpolation structure. The number of
multiply-add operations in the polyphase structure is approximately
(*L _{h}*

A more accurate flops count is computed in the program, but the exact count is still
approximate. For long signals *x*(*n*), the formula is often
exact.

`upfirdn`

performs a cascade of three operations:

Upsample the input data in the matrix

`xin`

by a factor of the integer`p`

(inserting zeros)FIR filter the upsampled signal data with the impulse response sequence given in the vector or matrix

`h`

Downsample the result by a factor of the integer

`q`

(throwing away samples)

The FIR filter is usually a lowpass filter, which you must design using another function
such as `firpm`

or `fir1`

.

[1] Crochiere, R. E., and Lawrence R.
Rabiner. *Multirate Digital Signal Processing*. Englewood Cliffs, NJ:
Prentice-Hall, 1983, pp. 88–91.

[2] Crochiere, R. E. “A General
Program to Perform Sampling Rate Conversion of Data by Rational Ratios.”
*Programs for Digital Signal Processing* (Digital Signal Processing
Committee of the IEEE Acoustics, Speech, and Signal Processing Society, eds.). New York: IEEE
Press, 1979, Programs 8.2-1–8.2-7.