Farrow Rate Converter
Polynomial samplerate converter with arbitrary conversion factor
Libraries:
DSP System Toolbox /
Signal Operations
Description
The Farrow Rate Converter block converts the sample rate of an input signal using polynomialfit samplerate conversion. Polynomialbased filters are efficient at implementing fractional sample rate conversion. Farrow structures are implementations of polynomialbased filters. This block uses a Farrow structure to implement arbitrary ratechange factors efficiently. The ratechange factors can be irrational.
Ports
Input
Port_1 — Input signal
scalar  vector  matrix
Specify the input signal as a real or a complexvalued scalar, vector, or a matrix signal.
The block treats each column of the input signal as a separate channel. If the input is a twodimensional 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 onedimensional signal, then the block interprets it as a singlechannel signal.
When you input a variablesize 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 fixedsize signal (frame length does not change during simulation), the frame length can be arbitrary only when you select the Allow arbitrary frame length for fixedsize 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
Port_1 — Rate converted signal
scalar  vector  matrix
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 fixedsize 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 fixedsize input signal.
FixedSize Input Signal
Input Signal  Output Signal Dimensions 

Pby1 column vector, where P is a multiple of the decimation factor M  (LP/M)by1, where L is the interpolation factor 
Pby1 column vector, where P is not a multiple of the decimation factor M 
If you do not select Allow arbitrary frame length for fixedsize input signals, the block errors. 
PbyQ matrix, where P is a multiple of the decimation factor M  (LP/M)byQ 
PbyQ matrix, where P is not a multiple of the decimation factor M 
If you do not select Allow arbitrary frame length for fixedsize input signals, the block errors. 
This table gives more details on the dimensions of the output signal when you input a variablesize input signal. When you input a variablesize signal (frame length changes during simulation), the Allow arbitrary frame length for fixedsize input signals appears on the block dialog box but does not have any impact on the input frame length. You can input a variablesize signal of any frame length even if you do not select the Allow arbitrary frame length for fixedsize input signals parameter.
VariableSize Input Signal
Input Signal  Output Signal Dimensions 

PbyQ 

Data Types: single
 double
 int8
 int16
 int32
 int64
 fixed point
Complex Number Support: Yes
Parameters
Main Tab
Sample rate of input signal (Hz) — Sample rate of input signal in Hz
48e3
(default)  positive scalar
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.
Sample rate of output signal (Hz) — Sample rate of output signal in Hz
96e3
(default)  positive scalar in Hz
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.
Tolerance for output sample rate — Maximum tolerance for output sample rate
0
(default)  positive scalar
Specify the maximum tolerance for the output sample rate as a positive scalar in the
range [0
0.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.
Filter Specification method — Method for specifying filter coefficients
Polynomial order
(default)  Coefficients
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.
Coefficients — Filter polynomial coefficients
[1 1; 1 0]
(default)  realvalued square matrix
Specify the filter polynomial coefficients as a realvalued square matrix.
Dependencies
To enable this parameter, set Filter specification method to
Coefficients
.
Polynomial order — Order of Lagrangeinterpolationfilter polynomial
3
(default)  positive integer less than or equal to 4
Specify the order of the Lagrangeinterpolationfilter polynomial as
1
, 2
, 3
, or
4
.
Dependencies
To enable this parameter, set Filter specification method to
Polynomial order
.
Allow arbitrary frame length for fixedsize input signals — Allow arbitrary frame length for fixedsize input signals
on (default)  off
Specify whether fixedsize 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 fixedsize input signals and ignores this parameter if the input has a variablesize.
When the input signal is a variablesize 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 fixedsize input signals, if you:
Select the Allow arbitrary frame length for fixedsize 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 variablesize signal. Therefore, to support arbitrary input size, the block must also support variablesize operations, which you can enable by selecting the Allow arbitrary frame length for fixedsize input signals parameter.
Clear the Allow arbitrary frame length for fixedsize input signals parameter, the input frame length must be a multiple of the decimation factor.
View Filter Response — View filter response
button
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.
View Info — View info
button
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.
Simulate using — Type of simulation to run
Code generation
(default)  Interpreted execution
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 thanInterpreted execution
.Interpreted execution
–– Simulate model using the MATLAB^{®} interpreter. This option shortens startup time but has slower simulation speed thanCode generation
.
Data Types Tab
Rounding mode — Rounding mode
Floor
(default)  Ceiling
 Convergent
 Nearest
 Round
 Zero
Specify the rounding mode for fixedpoint operations as one of the following:
Floor
Ceiling
Convergent
Nearest
Round
Simplest
Zero
For more details, see rounding mode.
Saturate on integer overflow — Method of overflow action
off (default)  on
When you select this parameter, the block saturates the result of its
fixedpoint operation. When you clear this parameter, the block wraps
the result of its fixedpoint operation. For details on
saturate
and wrap
, see overflow
mode for fixedpoint operations.
Coefficients — Data type of filter coefficients
fixdt(1,16)
(default)  fixdt(1,16,0)
Specify the data type of the filter coefficients as a signed fixedpoint object. The
default fixdt(1,16)
corresponds to a signed
fixedpoint type object with 16bit coefficients. For maximum precision,
the block determines the fraction length based on the coefficient
values.
Fractional Delay — Data type of fractional delay
fixdt(0,8)
(default)  fixdt(0,16)
Specify the data type of the fractional delay as an unsigned fixedpoint object. The
default fixdt(0,8)
corresponds to an unsigned
fixedpoint data type object with 8bit word length. For maximum
precision, the block computes the fractional length based on the
fractional delay values.
Multiplicand — Data type of multiplicand
fixdt(1,16,13)
(default)  fixdt(1,16,0)
Specify the multiplicand data type as a signed fixedpoint object. The
default fixdt(1,16,13)
corresponds to a
signed fixedpoint multiplicand data type with 16bit word length and
13bit fraction length.
Output — Data type of output
Inherit: Same word length as
input
(default)  Inherit: Same as accumulator
 fixdt(1,16)
 fixdt(1,16,0)
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 fixedpoint data type with 16bit 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 fixedpoint data type with 16bit word length and zero fraction length.
Output Minimum — Minimum value that the block can output
[]
(default)  scalar
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 fixedpoint data types.
Output Maximum — Maximum value that the block can output
[]
(default)  scalar
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 fixedpoint data types.
Lock data type settings against changes by the fixedpoint tools — Prevent fixedpoint tools from overriding data types
off
(default)  on
Select this parameter to prevent the fixedpoint tools from overriding the data types you specify in the block dialog box.
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

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 largeorder 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.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
FixedPoint Conversion
Design and simulate fixedpoint systems using FixedPoint Designer™.
If the input is fixed point, it must be a signed integer or a signed fixed point value with a poweroftwo slope and zero bias.
The diagram shows the data types that the Farrow Rate Converter block uses
for fixedpoint signals and floatingpoint signals. You can specify these data types
using the parameters on the Data Types tab. If the input is
floating point, all data types in the filter are the same as the input data type,
single
or double
.
If the input is fixed point, the FIR filter defines internal data types using the Rounding mode, Saturate on integer overflow, and Coefficients parameters. The accumulators and products within the FIR filter use fullprecision data types. The block casts the output of the FIR filter to the Multiplicand data type.
Version History
Introduced in R2015bR2022b: Support for arbitrary input frame length
Starting in R2022b, this block supports input signals with arbitrary frame lengths when the:
Input signal is a fixedsize signal (frame length does not change during simulation) and you select the Allow arbitrary frame length for fixedsize input signals parameter
Input signal is a variablesize signal (frame length changes during simulation)
When this block supports an arbitrary frame length input signal, the input frame length does not have to be a multiple of the decimation factor.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)