Main Content

designMultirateFIR

Multirate FIR filter design

Description

example

B= designMultirateFIR(L,M)designs a multirate FIR filter with interpolation factorLand decimation factorM. The outputBis the vector of designed FIR coefficients. To design a pure interpolator, setMto 1. To design a pure decimator, setLto 1.

example

B= designMultirateFIR(L,M,P)designs a multirate FIR filter with half-polyphase lengthP. By default, the half-polyphase length is12.

B= designMultirateFIR(L,M,TW)designs a multirate FIR filter with interpolation factorL,大量毁灭的因素M, and normalized transition widthTW.

example

B= designMultirateFIR(L,M,P,Astop)designs a multirate FIR filter with stopband attenuationAstop. By default, the stopband attenuation is 80 dB.

B= designMultirateFIR(L,M,TW,Astop)designs a multirate FIR filter with interpolation factorL,大量毁灭的因素M, normalized transition widthTW, and stopband attenuationAstop, specified in dB.

B= designMultirateFIR(___,'SystemObject',flag)returns a vector of filter coefficientsBif the flag is set tofalse, or a multirate filter System object™ if theflagis set totrue.

Examples

collapse all

To design an FIR Interpolator using thedesignMultirateFIRfunction, you must specify the interpolation factor of interest (usually greater than 1) and a decimation factor equal to 1. You can use the default half-polyphase length of 12 and the default stopband attenuation of 80 dB. Alternately, you can also specify the half-polyphase length and stopband attenuation values.

Design an FIR interpolator with interpolation factor set to 5. Use the default half-polyphase length of 12 and the default stopband attenuation of 80 dB.

b = designMultirateFIR(5,1); fvtool(b,'impulse')

Figure Impulse Response contains an axes object. The axes object with title Impulse Response contains an object of type stem.

To design an FIR Decimator using thedesignMultirateFIRfunction, you must specify the decimation factor of interest (usually greater than 1) and an interpolation factor equal to 1. You can use the default half-polyphase length of 12 and the default stopband attenuation of 80 dB. Alternately, you can also specify the half-polyphase length and stopband attenuation values. Design an FIR decimator with decimation factor set to 3, and half-polyphase length set to 14. Use the default stopband attenuation of 80 dB.

b = designMultirateFIR(1,3,14); fvtool(b,'impulse');

Figure Impulse Response contains an axes object. The axes object with title Impulse Response contains an object of type stem.

To design an FIR Rate Converter using thedesignMultirateFIR功能,您必须指定插值和decimation factors of interest (usually greater than 1). In addition, you can specify either the half-polyphase length and stopband attenuation values, or the normalized transition width and stopband attenuation values.

Design an FIR rate converter with interpolation factor set to 3, decimation factor set to 4, half-polyphase length set to 14, and stopband attenuation set to 90 dB.

b = designMultirateFIR(3,4,14,90); impz(b,1)

Figure contains an axes object. The axes object with title Impulse Response contains an object of type stem.

Design an FIR rate converter with interpolation factor set to 3, decimation factor set to 4, normalized transition width set to 0.2, and stopband attenuation set to 90 dB.

bTW = designMultirateFIR(3,4,0.2,90); impz(bTW,1)

Figure contains an axes object. The axes object with title Impulse Response contains an object of type stem.

Set the'SystemObject'flag totruein thedesignMultirateFIRfunction to design a multirate filter object. The design parameters specified in the function determine the type of System object the function designs.

In this example, the function designs a polyphase FIR interpolator System object™. For more details, seedsp.FIRInterpolator.

Create adsp.FIRInterpolatorobject with the interpolation factor equal to 5, transition width equal to 0.01, and stopband attenuation equal to 60 dB. Set the'SystemObject'flag totrueto design a multirate filter object.

firInterp = designMultirateFIR(5,1,0.01,60,'SystemObject',true); fvtool(firInterp)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Compute the cost of implementing the filter.

cost(firInterp)
ans =struct with fields:NumCoefficients: 582 NumStates: 145 MultiplicationsPerInputSample: 582 AdditionsPerInputSample: 578

Measure the frequency response characteristics of the filter object.

measure(firInterp)
ans = Sample Rate : N/A (normalized frequency) Passband Edge : 0.195 3-dB Point : 0.19884 6-dB Point : 0.2 Stopband Edge : 0.205 Passband Ripple : 0.016474 dB Stopband Atten. : 60.1827 dB Transition Width : 0.01

Input Arguments

collapse all

Interpolation factor, specified as a positive scalar integer. To design a decimator only, setLto1.

Example:2

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Decimation factor, specified as a positive scalar integer. To design an interpolator only, setMto1.

Example:2

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Half-polyphase length, specified as a positive scalar integer that is greater than or equal to 1.

Example:12

Example:20

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Normalized transition width of the multirate FIR filter, specified as a real scalar in the range (0 1).

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Stopband attenuation in dB, specified as a nonnegative real scalar greater than or equal to0.

Example:0.0

Example:80.5

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

System object flag set to:

Data Types:logical

Output Arguments

collapse all

Multirate FIR filter coefficients, returned as a real-valuedN-length vector.

If bothLandMare equal to 1, thenNequals 1.

IfL> 1 orM> 1, thenNis given by N = { 2 P R + 1 2 P R M > L > 1 and mod ( P L , M ) 0 otherwise , wherePis the half-polyphase length andRis defined by the following equations:

  • IfL> 1,R=L.

  • IfL= 1,R=M.

For more details, see theAlgorithmssection.

When the'SystemObject'flag is set totrue, the function returns one of the following multirate filter System objects:

Data Types:double

Algorithms

designMultirateFIRdesigns anRthband Nyquist FIR filter using a Kaiser window vector to window the truncated impulse response of the FIR filter.

的filter lengthNis defined as one of the following:

N = { 2 P R + 1 2 P R M > L > 1 and mod ( P L , M ) 0 otherwise

Pis the half-polyphase length andRis defined as explained inB.

的truncated impulse responsed(n)is delayed byN/2样品的因果。的truncated and delayed impulse response is given by:

d ( n N / 2 ) = sin ( w c ( n N / 2 ) ) π ( n N / 2 ) , n = 0 , , N 2 , , N

where w c = π / R .

For everyRthband, the impulse response of the Nyquist filters is exactly zero. Because of this property, when Nyquist filters are used for pure interpolation, the input samples remain unaltered after interpolating.

A Kaiser window is used because of its near-optimum performance while providing a robust way of designing a Nyquist filter. The window depends on two parameters: lengthN+ 1 and shape parameterβ.

的Kaiser window is defined by:

w ( n ) = I 0 ( β 1 ( n N / 2 N / 2 ) 2 ) I 0 ( β ) , 0 n N ,

whereI0is the zeroth-order modified Bessel function of the first kind.

的shape parameter β is calculated from:

β = { 0.1102 ( A s t o p 8.7 ) if A s t o p 50 0.5842 ( A s t o p 21 ) 0.4 + 0.07886 ( A s t o p 21 ) if 21 < A s t o p < 50 0 if A s t o p 21 ,

whereAstopis the stopband attenuation in dB.

的windowed impulse response is given by

h ( n ) = w ( n ) d ( n N / 2 ) = w ( n ) sin ( w c ( n N / 2 ) ) π ( n N / 2 ) , n = 0 , , N 2 , , N

h(n)forn = 0,..,N/2,...Nare the coefficients of the multirate filter. These coefficients are defined by the interpolation factor,L, and decimation factor,M.

References

[1] Orfanidis, Sophocles J.Introduction to Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1996.

Extended Capabilities

版本历史

Introduced in R2016a