Engee documentation

FIR Rate Conversion

A polyphase sampling frequency converter based on an FIR filter.

blockType: SubSystem

Path in the library:

/Signal Operations/Filters/MultirateFilters/FIR Rate Conversion

Description

Block FIR Rate Conversion performs an efficient polyphase conversion of the sampling frequency using a rational coefficient along the first dimension. The block treats each column of the input signal as a separate channel and resamples the data in them independently of each other.

Conceptually, the frequency converter combines an FIR interpolator and an FIR decimator. The scheme presented below contains a frequency boost element that combines reconstruction and smoothing filters, as well as a frequency reduction element.

The frequency converter performs the following actions:

  • Increases the sampling rate of the input data to a higher one by adding zeros between the input samples.

  • Passes the sampled data through the FIR filter.

  • Reduces the sampling rate of the filtered data to a lower one by discarding consecutive samples following each sample that the block stores.

fir rate conversion 1 en

Note that the actual block algorithm is performed using polyphase decomposition, which is more efficient than the concept presented above. For more information, see Algorithms.

Ports

Entrance

In — input signal
scalar | vector | the matrix

The input signal can be specified as a scalar, vector, or matrix of size on . In the latter case, the input signal columns represent independent channels.

For more information, see Frame-based processing.

Data types: Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers: Yes

Output

Out — converted pass signal:q[<br>] scalar | vector | the matrix

The output data after frequency conversion can be represented as a scalar, vector, or matrix.

The behavior of the block depends on the value of the Rate options parameter:

  • Enforce single-rate processing — the block retains the sampling frequency of the input signal, but converts the dimension in such a way that the channel size in the output signal differs in times relative to the entrance. The output has an upper bound on the size on to enter the size on .

  • Allow multirate processing — the unit decimates the signal so that the sampling frequency of the output signal is in times the sampling rate of the input. The size of the output frame is the same as the size of the input frame, but the sampling rate is the same. .

All units connected to the output operate at a sampling frequency. , and all units connected to the input operate at the sampling frequency .

Data types: Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers: Yes

Parameters

Efficient source — a way to set the coefficients of the pass filter:q[<br>] Dialog parameters (by default)

If the parameter has a value Dialog parameters, then the filter coefficients are set in the parameter settings window.

Interpolation factor — interpolation coefficient of
3 (default) | positive scalar

Specify the integer coefficient . The block increases the sampling rate of the input sequence according to this coefficient before filtering.

Dependencies

To use this parameter, set the Efficient source parameter to Dialog parameters.

Data types: Int8, Int16, Int32, Int64

FIR filter coefficients — coefficients of the low-pass FIR filter
[0 -0.000129061486199961 -0.000228040316280948 0 0.000554613738572437 0.000802607430267054 0 -0.00152912350278902 -0.00203638780675590 0 0.00342230705979440 0.00433928347039265 0 -0.00673109372352446 -0.00825637814441869 0 0.0121125402586868 0.0145130044012328 0 -0.0204721583515830 -0.0241392529239787 0 0.0332125142618354 0.0388230898504630 0 -0.0529640018790903 -0.0619837024555044 0 0.0860610417481775 0.102712774109103 0 -0.154048515452570 -0.197567026018057 0 0.408837525145054 0.824655115145336 1 0.824655115145336 0.408837525145054 0 -0.197567026018057 -0.154048515452570 0 0.102712774109103 0.0860610417481775 0 -0.0619837024555044 -0.0529640018790903 0 0.0388230898504630 0.0332125142618354 0 -0.0241392529239787 -0.0204721583515830 0 0.0145130044012328 0.0121125402586868 0 -0.00825637814441869 -0.00673109372352446 0 0.00433928347039265 0.00342230705979440 0 -0.00203638780675590 -0.00152912350278902 0 0.000802607430267054 0.000554613738572437 0 -0.000228040316280948 -0.000129061486199961] ( by default) | vector

Specify the FIR filter coefficients in descending order from .

Dependencies

To use this parameter, set the Efficient source parameter to Dialog parameters.

Data types: Int8, Int16, Int32, Int64

Support for complex numbers: Yes

Decimation factor — pass decimation coefficient:q[<br>] 2 (by default) | positive scalar

Specify the integer coefficient . The block reduces the sampling rate of the input sequence according to this coefficient after filtering.

Dependencies

To use this parameter, set the Efficient source parameter to Dialog parameters.

Data types: Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Rate options — provide single-speed or allow multi-speed pass processing:q[<br>] Enforce single-rate processing (by default) | Allow multirate processing

Specify which processing to use. Options to choose from:

  • Enforce single-rate processing — the size of the output frame is equal to the size of the input frame multiplied by , where – the interpolation coefficient, and — the decimation coefficient.

.

The sampling rate of the output signal is equal to the sampling rate of the input signal:

.

  • Allow multirate processing — the size of the output frame is equal to the size of the input frame:

.

The sampling rate of the output signal is equal to the sampling rate of the input signal multiplied by :

.

All units connected to the output operate at a sampling frequency. and all the units connected to the input operate at the sampling frequency .

Allow arbitrary frame length for fixed-size input signals — allow arbitrary frame length for fixed-size input signals
disabled (by default) | enabled

Specify whether fixed-size input signals (whose size does not change during simulation) can be converted to an input signal with an arbitrary frame length. In this case, the input frame length does not have to be a multiple of the decimation factor.

For fixed-size input signals:

  • Select the Allow arbitrary frame length for fixed-size input signals checkbox if the length of the input signal frame does not have to be a multiple of the decimation factor. In the event that the first dimension of the input signal is not a multiple of the decimation coefficient, then the output is usually a variable-size signal. Therefore, to support arbitrary-size input signals, the block must also support operations with variable-size signals, which is achieved by checking the Allow arbitrary frame length for fixed-size input signals checkbox.

  • Uncheck Allow arbitrary frame length for fixed-size input signals if the input frame length must be a multiple of the decimation factor.

Dependencies

To use this parameter, set the Rate options parameter to Enforce single-rate processing.

Additional Info

Setting the FIR filter coefficients

In the FIR filter coefficients parameter, you must set the coefficients of the FIR filter numerator as a vector.

Transfer function The FIR filter is defined as:

The coefficient vector must have a length exceeding the interpolation coefficient ( ). The FIR filter must be a low-pass filter with a normalized cutoff frequency of no more than . The block initializes all filter states internally with zero.

Setting the sampling frequency

This section applies only to the single-speed processing mode when the Rate options parameter is set to Enforce single-rate processing.

Block sampling rate FIR Rate Conversion It is set using the Decimation factor and Interpolation factor parameters. For the input matrix on Decimation factor parameters and Interpolation factor must meet the following requirements:

  • and they must be mutually prime numbers. That is, the relation it cannot be reduced to a ratio of smaller integers.

  • , where and — the whole frame sizes at the input and output, respectively. You can satisfy the second requirement by setting the Decimation factor equal to the size of the frame at the input . In this case, the output frame size is will be equal to Interpolation factor .

By changing the frame size in this way, the block is able to keep the frame period constant ( ) and achieve the desired transformation of the sampling period such that

where – the sampling period at the output.

The picture below shows how the block FIR Rate Conversion converts a 4-by-1 input signal with a sampling period 3/4 into a 3-by-1 output signal with a sampling period 1. Frame period ( ), equal to 3, remains constant. Parameter values for this example:

  • The interpolation factor matters 3;

  • Decimation factor matters 4;

  • Rate options matters Enforce single-rate processing.

fir rate conversion 2 en

Frame-based processing

Block FIR Rate Conversion resamples each column of the input signal by time. In this mode, the unit can perform both single-speed and multi-speed processing. You can use the Rate options parameter to specify how the block will recalculate the input data.:

  • If the Rate options parameter is set to Enforce single-rate processing, then the input and output data of the block have the same sampling rate. To resample the output while maintaining the input sampling rate, the block transforms the data in each input column so that the output frame length has an upper bound on the size , where — the interpolation coefficient specified in the Interpolation factor parameter, — the length of the input frame, and — the decimation coefficient specified in the Decimation factor parameter.

In this mode, if a fixed-size signal is received at the input (the frame length does not change during simulation) and the Allow arbitrary frame length for fixed-size input signals checkbox is selected, then the input frame length can be arbitrary and does not necessarily have to be a multiple of the decimation factor. If the Allow arbitrary frame length for fixed-size input signals checkbox is not set, the input frame length must be a multiple of the decimation factor.

  • If the Rate options parameter is set to Allow multirate processing, then the input and output data have the same size, but the sampling rate of the output signal is in times more than the input. In this mode, the block processes the input matrix on how independent channels. The block decimates each column of the input signal in time, keeping the frame size constant and making the period of the output frame ( ) in times longer than the period of the input frame ( ).

Algorithms

Frequency conversion with an FIR filter can be efficiently performed based on a polyphase representation.

To move on to the polyphase representation, let’s start by defining the transfer function of the FIR filter, which is a combination of a reconstruction and smoothing filter.:

where — this is the length of the FIR filter.

You can rearrange this equation as follows:

where — this is the number of polyphase components, this value is equal to the interpolation coefficient, which is set in the parameter settings window.

You can write this equation as:

where , , …​, — these are the polyphase components of the FIR filter .

Conceptually, a frequency converter with an FIR filter contains a sampling rate boost element, followed by a combined FIR filter , followed by a sample rate reduction element.

fir rate conversion 1 en

Replace its polyphase representation.

fir rate conversion 3

The identity for multidimensional interpolation is presented here.

fir rate conversion 4 en

Applying the identity for interpolation moves the operation of adding zero samples (the operation of increasing the frequency) after the filtering operation. This move allows you to filter the signal at a lower rate.

fir rate conversion 5

You can replace the sampling rate boost element, the delay unit, and the adder with a switching switch. To account for the subsequent element of lowering the sampling rate, the switch moves in increments . The switch gets the first selection from branch 0 and moves counterclockwise, skipping each time the branch.

As an example, consider a speed converter with , set to 5, and installed on 3. Polyphase components: , , , , and . The switch starts on the first branch 0, skips branches 1 and 2, gets the next sample from branch 3, then skips branches 4 and 0, gets the next sample from branch 2, and so on. The sequence of branches from which the switch receives a data sample is [0, 3, 1, 4, 2, 0, 3, 1, …​.].

Thus, in the process Frequency conversion First, an interpolation coefficient is applied to the input data , and then a switch is used to isolate only 1 out of M data samples, which effectively takes into account the decimation coefficient. . The total sampling rate at the output of the converter is .

fir rate conversion 6 en

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