Main Content

Farrow Rate Converter

Polynomial sample-rate converter with arbitrary conversion factor

  • Farrow Rate Converter block

Libraries:
DSP System Toolbox / Signal Operations

Description

The Farrow Rate Converter block converts the sample rate of an input signal using polynomial-fit sample-rate conversion. Polynomial-based filters are efficient at implementing fractional sample rate conversion. Farrow structures are implementations of polynomial-based filters. This block uses a Farrow structure to implement arbitrary rate-change factors efficiently. The rate-change factors can be irrational.

Ports

Input

expand all

Specify the input signal as a real or a complex-valued scalar, vector, or a matrix signal.

The block treats each column of the input signal as a separate channel. If the input is a two-dimensional signal, the first dimension represents the channel length (or frame size) and the second dimension represents the number of channels. If the input is a one-dimensional signal, then the block interprets it as a single-channel signal.

When you input a variable-size signal (frame length changes during simulation), the frame length of the signal can be arbitrary, that is, the input frame length does not have to be a multiple of the decimation factor. When you input a fixed-size signal (frame length does not change during simulation), the frame length can be arbitrary only when you select the Allow arbitrary frame length for fixed-size input signals parameter.

To determine the decimation factor, click the View Info button in the block dialog.

Data Types: single | double | int8 | int16 | int32 | int64 | fixed point
Complex Number Support: Yes

Output

expand all

The Farrow Rate Converter block outputs a signal that has the same data type and complexity as the input signal.

The output signal dimensions depend on the input signal dimensions, the overall interpolation and decimation factors of the Farrow Rate Converter block, and whether you select the Allow arbitrary frame length for fixed-size input signals parameter. You can determine the overall interpolation factor L and the decimator factor M by clicking the View Info button in the block dialog box.

This table provides more details on the dimensions of the output signal when you input a fixed-size input signal.

Fixed-Size Input Signal

Input SignalOutput Signal Dimensions

P-by-1 column vector, where P is a multiple of the decimation factor M

(LP/M)-by-1, where L is the interpolation factor

P-by-1 column vector, where P is not a multiple of the decimation factor M

ceil(LP/M)-by-1 when you select Allow arbitrary frame length for fixed-size input signals.

If you do not select Allow arbitrary frame length for fixed-size input signals, the block errors.

P-by-Q matrix, where P is a multiple of the decimation factor M

(LP/M)-by-Q

P-by-Q matrix, where P is not a multiple of the decimation factor M

ceil(LP/M)-by-Q when you select Allow arbitrary frame length for fixed-size input signals.

If you do not select Allow arbitrary frame length for fixed-size input signals, the block errors.

This table gives more details on the dimensions of the output signal when you input a variable-size input signal. When you input a variable-size signal (frame length changes during simulation), the Allow arbitrary frame length for fixed-size input signals appears on the block dialog box but does not have any impact on the input frame length. You can input a variable-size signal of any frame length even if you do not select the Allow arbitrary frame length for fixed-size input signals parameter.

Variable-Size Input Signal

Input SignalOutput Signal Dimensions

P-by-Q

ceil(LP/M)-by-Q

Data Types: single | double | int8 | int16 | int32 | int64 | fixed point
Complex Number Support: Yes

Parameters

expand all

Main Tab

Specify the sample rate of the input signal as a positive scalar in Hz. The input sample rate must be greater than the bandwidth of interest.

Specify the sample rate of the output signal as a positive scalar in Hz. The output sample rate must be higher or lower than the input sample rate.

Specify the maximum tolerance for the output sample rate as a positive scalar in the range [00.5].

The actual output sample rate varies but is within the specified range. For example, if you set the Tolerance for output sample rate to 0.01, then the actual output sample rate is in the range given by sample rate of output signal ± 1%. This flexibility allows for a simpler filter design.

Specify the method the block uses to determine the polynomial interpolator coefficients as one of the following:

  • Polynomial order — Specify the order of the Lagrange interpolation filter polynomial through the Polynomial order parameter.

  • Coefficients — Specify the polynomial coefficients directly through the Coefficients parameter.

Specify the filter polynomial coefficients as a real-valued square matrix.

Dependencies

To enable this parameter, set Filter specification method to Coefficients.

Specify the order of the Lagrange-interpolation-filter polynomial as 1, 2, 3, or 4.

Dependencies

To enable this parameter, set Filter specification method to Polynomial order.

Specify whether fixed-size input signals (whose size does not change during simulation) can have an arbitrary frame length, where the frame length does not have to be a multiple of the decimation factor. The block uses this parameter setting only for fixed-size input signals and ignores this parameter if the input has a variable-size.

When the input signal is a variable-size signal, the signal can have arbitrary frame length, that is, the frame length does not have to be a multiple of the decimation factor.

For fixed-size input signals, if you:

  • Select the Allow arbitrary frame length for fixed-size input signals parameter, the frame length of the signal does not have to be a multiple of the decimation factor. If the input is not a multiple of the decimation factor, then the output is generally a variable-size signal. Therefore, to support arbitrary input size, the block must also support variable-size operations, which you can enable by selecting the Allow arbitrary frame length for fixed-size input signals parameter.

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

Opens the FVTool and displays the magnitude/phase response of the Farrow Rate Converter. The response is based on the block parameters. FVTool updates when you change the parameters.

To update the magnitude response while FVTool is running, modify the parameters in the dialog box and click Apply.

Click this button for the block to display the following information about the Farrow filter system:

  • Filter Structure

  • Interpolation Factor

  • Decimation Factor

  • Filter Length

  • Stable

  • Linear Phase

This button brings the functionality of the info method into the Simulink® environment.

Type of simulation to run. You can set this parameter to:

  • Code generation –– Simulate model using generated C code. The first time you run a simulation, Simulink generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than Interpreted execution.

  • Interpreted execution –– Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than Code generation.

Data Types Tab

Specify the rounding mode for fixed-point operations as one of the following:

  • Floor

  • Ceiling

  • Convergent

  • Nearest

  • Round

  • Simplest

  • Zero

For more details, see rounding mode.

When you select this parameter, the block saturates the result of its fixed-point operation. When you clear this parameter, the block wraps the result of its fixed-point operation. For details on saturate and wrap, see overflow mode for fixed-point operations.

Specify the data type of the filter coefficients as a signed fixed-point object. The default fixdt(1,16) corresponds to a signed fixed-point type object with 16-bit coefficients. For maximum precision, the block determines the fraction length based on the coefficient values.

Specify the data type of the fractional delay as an unsigned fixed-point object. The default fixdt(0,8) corresponds to an unsigned fixed-point data type object with 8-bit word length. For maximum precision, the block computes the fractional length based on the fractional delay values.

Specify the multiplicand data type as a signed fixed-point object. The default fixdt(1,16,13) corresponds to a signed fixed-point multiplicand data type with 16-bit word length and 13-bit fraction length.

Specify the word length and fraction length of the output data type as one of the following:

  • Inherit: Same word length as input (default) — Output word length and fraction lengths are the same as the input.

  • Inherit: Same as accumulator — Output word length and fraction lengths are the same as the accumulator.

  • fixdt(1,16) — Signed fixed-point data type with 16-bit word length. For maximum precision, the block computes the fraction length based on the input range and preserves the dynamic range of the input.

  • fixdt(1,16,0) — Signed fixed-point data type with 16-bit word length and zero fraction length.

Specify the minimum value that the block can output. Simulink software uses this minimum value to perform:

  • Simulation range checking. See Specify Signal Ranges (Simulink).

  • Automatic scaling of fixed-point data types.

Specify the maximum value that the block can output. Simulink software uses this maximum value to perform:

  • Simulation range checking. See Specify Signal Ranges (Simulink).

  • Automatic scaling of fixed-point data types.

Select this parameter to prevent the fixed-point tools from overriding the data types you specify in the block dialog box.

Block Characteristics

Data Types

double | fixed point | integer | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

yes

Zero-Crossing Detection

no

Algorithms

Farrow filters implement piecewise polynomial interpolation using Horner’s rule to compute samples from the polynomial. The polynomial coefficients used to fit the input samples correspond to the Lagrange interpolation coefficients.

Once a polynomial is fitted to the input data, the value of the polynomial can be calculated at any point. Therefore, a polynomial filter enables interpolation at arbitrary locations between input samples.

You can use a polynomial of any order to fit to the existing samples. However, since large-order polynomials frequently oscillate, polynomials of order 1, 2, 3, or 4 are used in practice.

The algorithm computes interpolated values at the desired locations by varying only the fractional delay µ. This value is the interval between the previous input sample and the current output sample. All filter coefficients remain constant.

  • The input samples are filtered using M + 1 FIR filters, where M is the polynomial order.

  • The outputs of these filters are multiplied by the fractional delay, µ.

  • The output is the sum of the multiplication results.

Here is the filter structure diagram of the Farrow filter with a polynomial order of 4.

Input going through a sample buffer containing three delay blocks. Farrow coefficients matrix multiplied with the output of the sample buffer to form polynomial coefficients. The Horner method uses these coefficients and fractional delay to compute the output. The signals in the diagram are color coded based on their data types. Colored lines represent explicit (user-defined) data types. Input signals are color coded in blue. Farrow coefficients matrix cast is color coded in yellow and use the Coefficients data type. All the multiplicand data types are color coded in red. Fractional delay data types are color coded in green and output data type is color coded in purple. Black lines at the outputs of multipliers and adders represent implicit (derived) maximum precision data type.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2015b

expand all