Sample rate converter
The dsp.FIRRateConverter
System object™ performs sampling rate conversion by a rational factor on a vector or matrix
input. The FIR rate convertor cascades an interpolator with a decimator. The rate converter
(as shown in the schematic) conceptually consists of an upsampler, followed by a combined
anti-imaging and anti-aliasing FIR filter, followed by a downsampler. To design an FIR filter
which acts as a combined anti-imaging and anti-aliasing FIR filter, use the designMultirateFIR
function. For an example, see Resample a Signal using FIR Rate Converter.
The upsampler increases the sample rate of the signal by a factor L and the downsampler reduces the sample rate of the signal by a factor M. Use upsampling and downsampling factors that are relatively prime or coprime. The resulting discrete-time signal has a sample rate that is L/M times the original sample rate.
Note that the actual object algorithm implements a polyphase structure, an efficient equivalent of the combined system depicted in the diagram. For more details, see Algorithms.
To perform sampling rate conversion:
Create the dsp.FIRRateConverter
object and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
returns a FIR
sample rate converter, firrc
= dsp.FIRRateConverterfirrc
, that resamples an input signal at a rate
3/2 times the original sampling rate.
returns an FIR sample rate converter, firrc
= dsp.FIRRateConverter(L,M,NUM)firrc
, with the
InterpolationFactor
property set to L
, the
DecimationFactor
property set to M
, and the Numerator
property set to NUM
.
returns an FIR sample rate converter, with additional properties specified by one or more
firrc
= dsp.FIRRateConverter(___,Name,Value
)Name,Value
pair arguments.
firrc =
dsp.FIRRateConverter('FullPrecisionOverride','false')
enables the fixed-point
data types to be controlled through the individual fixed-point property
settings.To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
The FIR rate converter is implemented efficiently using a polyphase structure.
To derive the polyphase structure, start with the transfer function of the FIR filter: This FIR filter is a combined anti-imaging and anti-aliasing filter.
N+1 is the length of the FIR filter.
You can rearrange this equation as follows:
L is the number of polyphase components, and its value equals the interpolation factor that you specify.
You can write this equation as:
E0(zL), E1(zL), ..., EL-1(zL) are polyphase components of the FIR filter H(z).
Conceptually, the FIR rate converter contains an upsampler, followed by a combined anti-imaging, anti-aliasing FIR filter H(z), which is followed by a downsampler.
Replace H(z) with its polyphase representation.
Here is the multirate noble identity for interpolation.
Applying the noble identity for interpolation moves the upsampling operation to after the filtering operation. This move enables you to filter the signal at a lower rate.
You can replace the upsampling operator, delay block, and the adder with a commutator switch. To account for the downsampler that follows, the switch moves in steps of size M. The switch receives the first sample from branch 0 and moves in the counter clockwise direction, each time skipping M−1 branches.
As an example, consider a rate converter with L set to 5 and M set to 3. The polyphase components are E0(z), E1(z), E2(z), E3(z), and E4(z). The switch starts on the first branch 0, skips branches 1 and 2, receives the next sample from branch 3, then skips branches 4 and 0, receives the next sample from branch 2, and so on. The sequence of branches from which the switch receives the data sample is [0, 3, 1, 4, 2, 0, 3, 1, ….].
The rate converter implements the L/M conversion by first applying the interpolation factor L to the incoming data, and using the commutator switch at the end to receive only 1 in M samples, effectively accounting for the dowsampling factor M. Hence, the sample rate at the output of the FIR rate converter is Lfs/M.