Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

farrow - Farrow filter

Syntax

hd = farrow.structure(delay,...)

Description

hd = farrow.structure(delay,...) returns a Farrow filter hd that associates delay, the fractional delay, with a filter structure specified by structure.

Digital fractional delay filters are useful tools for fine-tuning the sampling instants of signals, such as implementing the required bandlimited interpolation. They can be found in the synchronization of digital modems where the delay parameter varies over time, or in wireless communications systems where the signal delay changes with location and distance from the transmitter. Farrow filters are one such fractional delay filter that allows the user to vary the delay.

More information about Farrow filters is available in References.

You can change the fractional delay input value as you filter by assigning a new value to delay before you filter with hd. Thus Farrow filters provide delay tunability when your input signals have time-varying delays.

Provide the fractional delay as a decimal part of an input sample, such as 0.2. delay must be positive and between 0 and 1.

structure accepts the following strings that describe the filter structure to use:

structure String

Description

fd

Generic fractional delay Farrow filter

linearfd

Linear fractional delay Farrow filter

In the farrow.fd syntax

hd = farrow.fd(delay,...)

you must specify the coefficients as input arguments. Use fdesign.fracdelay to generate farrow.fd filter design coefficients. For more information about the coefficients, refer to References.

Farrow filters support numerous functions for analyzing and simulating the filter, and for generating code from the filter. To learn about the functions you use with Farrow filters, enter

help farrow/functions

at the Command prompt to see the complete list of functions.

The functions and methods that you use most often with digital filters are

Function

Description

cost

Estimate the hardware implementation cost in terms of mathematical operations like add and multiply

filter

Execute the filter by using it to filter data

fvtool

Display and analyze the filter

freqrespest

Use filtering to estimate filter frequency response

freqz

Compute the instantaneous frequency response of the filter

realizemdl

Generate a Simulink subsystem model of the filter as a block (Requires Simulink)

Fixed-Point Farrow Filters

Make this filter a fixed-point or single-precision filter by changing the value of the Arithmetic property for the filter hd as follows:

For more information about the property Arithmetic, refer to Arithmetic.

Fixed-Point Filter Structure

The following figure shows the signal flow for the fractional delay Farrow filter implemented by farrow.fd. To help you see how the filter processes the coefficients, input, output, and states of the filter, as well as numerical operations, the figure includes the locations of the arithmetic and data type format elements within the signal flow.

Notes About the Signal Flow Diagram

To help you understand where and how the filter performs fixed-point arithmetic during filtering, the preceding signal flow diagram includes labels associated with data and functional elements in the filter. The following table describes each label in the signal flow and relates the label to the filter properties that correspond to it.

The labels use a common format — a descriptor followed by WL or FL. WL stands for word length and FL for fraction length. The pairing of WL and FL entries explain the data format at the labeled location in the filter.

For example, InputWL label refers to the word length and InputFL to the fraction length used to interpret data you input to the filter. The corresponding filter properties InputWordLength and InputFracLength (as shown in the following table) store the word length and the fraction length in bits in the filter object. Or consider CoeffFormat, which refers to the word and fraction lengths (CoeffWordLength, CoeffFracLength) associated with representing filter coefficients.

Signal Flow Label

Corresponding Filter Property

InputWL

InputWordLength

InputFL

InputFracLength

FracDelayWL

FDWordLength

FracDelayFL

FDFracLength

CoeffWL

CoeffWordLength

CoeffFL

CoeffFracLength

ProductWL

ProductWordLength

ProductFL

ProductFracLength

AccumWL

AccumWordLength

AccumFL

AccumFracLength

MultiplicandWL

MultiplicandWordLength

MultiplicandFL

MultiplicandFracLength

FracDelayProdWL

FDProdWordLength

FracDelayProdFL

FDProdFracLength

OutputWL

OutputWordLength

OutputFL

OutputFracLength

Properties

In this table you see the properties associated with Farrow filters in fixed-point form.

For further information about the properties of this filter or any dfilt object, refer to Fixed-Point Filter Properties.

Property Name

Brief Description

AccumFracLength

Sets the fraction length used to store data in the accumulator/buffer.

AccumWordLength

Sets the word length used to store data in the accumulator/buffer.

Arithmetic

Defines the arithmetic the filter uses. Gives you the options double, single, and fixed. In short, this property defines the operating mode for your filter.

CoeffAutoScale

Specifies whether the filter automatically chooses the proper fraction length to represent filter coefficients without overflowing. Turning this off by setting the value to false enables you to change the CoeffWordLength and CoeffFracLength properties to specify the data format used.

CoeffFracLength

Specifies the fraction length to apply to filter coefficients.

CoefficientsContains the coefficients for the filter.

CoeffWordLength

Specifies the word length to apply to filter coefficients.

FilterStructure

Describes the signal flow for the filter object, including all of the active elements that perform operations during filtering — gains, delays, sums, products, and input/output.

FDAutoScale

Specifies whether the filter automatically chooses the proper scaling to represent the fractional delay value without overflowing. Turning this off by setting the value to false enables you to change the FDWordLength and FDFracLength properties to specify the data format applied.

FDFracLengthSpecifies the fraction length to represent the fractional delay.
FDProdFracLengthSpecifies the fraction length to represent the result of multiplying the coefficients with the fractional delay.
FDProdWordLengthSpecifies the word length to represent result of multiplying the coefficients with the fractional delay.
FDWordLengthSpecifies the word length to represent the fractional delay.
FilterInternals

Controls whether the filter automatically sets the output word and fraction lengths, product word and fraction lengths, and the accumulator word and fraction lengths to maintain the best precision results during filtering. The default value, FullPrecision, sets automatic word and fraction length determination by the filter. SpecifyPrecision makes the output and accumulator-related properties available so you can set your own word and fraction lengths for them.

FilterStructure

Describes the signal flow for the filter object, including all of the active elements that perform operations during filtering — gains, delays, sums, products, and input/output.

FracDelaySpecifies the fractional delay provided by the filter, in decimal fractions of a sample.

InputFracLength

Specifies the fraction length the filter uses to interpret input data.

InputWordLength

Specifies the word length applied to interpret input data.

MultiplicandFracLength

Specifies the fraction length to use for multiplication operation inputs. This property becomes writable (you can change the value) when you set FilterInternals to SpecifyPrecision.

MultiplicandWordLength

Specifies the word length to use for multiplication operation inputs. This property becomes writable (you can change the value) when you set FilterInternals to SpecifyPrecision.

OutputFracLength

Determines how the filter interprets the filter output data. You can change the value of OutputFracLength when you set OutputMode to SpecifyPrecision.

OutputWordLength

Determines the word length used for the output data.

OverflowMode

Sets the mode used to respond to overflow conditions in fixed-point arithmetic. Choose from either saturate (limit the output to the largest positive or negative representable value) or wrap (set overflowing values to the nearest representable value using modular arithmetic). The choice you make affects only the accumulator and output arithmetic. Coefficient and input arithmetic always saturates. Finally, products never overflow — they maintain full precision.

PersistentMemory

Specifies whether to reset the filter states and memory before each filtering operation. Lets you decide whether your filter retains states from previous filtering runs. False is the default setting.

ProductFracLength

Specifies the fraction length to use for multiplication operation results. This property becomes writable (you can change the value) when you set FilterInternals to SpecifyPrecision.

ProductWordLength

Specifies the word length to use for multiplication operation results. This property becomes writable (you can change the value) when you set FilterInternals to SpecifyPrecision.

RoundMode

Sets the mode the filter uses to quantize numeric values when the values lie between representable values for the data format (word and fraction lengths).

  • ceil - Round toward positive infinity.

  • convergent - Round to the closest representable integer. Ties round to the nearest even stored integer. This is the least biased of the methods available in this software.

  • fix - Round toward zero.

  • floor - Round toward negative infinity.

  • nearest - Round toward nearest. Ties round toward positive infinity.

  • round - Round toward nearest. Ties round toward negative infinity for negative numbers, and toward positive infinity for positive numbers.

The choice you make affects only the accumulator and output arithmetic. Coefficient and input arithmetic always round. Finally, products never overflow — they maintain full precision.

Signed

Specifies whether the filter uses signed or unsigned fixed-point coefficients. Only coefficients reflect this property setting.

States

This property contains the filter states before, during, and after filter operations. States act as filter memory between filtering runs or sessions. The states use fi objects, with the associated properties from those objects. For details, refer to filtstates in Signal Processing Toolbox documentation or in the Help system.

Examples

Construct a filter with linear fractional delay of 0.4 samples. Use linearfd for the structure and set delay equal to 0.4.

delay = 0.4;
hd = farrow.linearfd(delay);
fvtool(hd) % Analyze the filter.

realizemdl produces this model from basic Signal Processing blockset blocks.

References

Erup, L., Floyd M. Gardner, and Robert A. Harris, "Interpolation in Digital Modems-Part II: Implementation and Performance," IEEE Transactions on Communications, vol. 41, No. 6, June 1993, pp. 998-1008.

Marvasti, F., Nonuniform Sampling—Theory and Practice, Kluwer Academic/Plenum Publishers, New York, 2001.

See Also

adaptfilt, dfilt, fdesign, mfilt

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS