| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Signal Processing Blockset |
| Contents | Index |
| Learn more about Signal Processing Blockset |
Signal Operations
dspsigops
The Variable Fractional Delay block delays each element of the discrete-time N-D input array, u, by a variable number of sample intervals. The input delay values can be integer or noninteger values. The block provides three different interpolation modes: Linear, FIR, and Farrow.
The block computes the value for each channel of the output based on the stored samples in memory most closely indexed by the Delay input, v, and the interpolation method specified by the Interpolation mode parameter.
In Linear interpolation mode, the block stores the Dmax+1 most recent samples received at the In port for each channel, where Dmax is the value specified for the Maximum delay (Dmax) in samples parameter.
In FIR interpolation mode, the block stores the Dmax+P+1 most recent samples received at the In port for each channel, where P is the value specified for the Interpolation filter half-length (P) parameter.
In Farrow interpolation
mode, the block stores the Dmax+
+1 most recent samples received
at the In port for each channel, where N is the
value specified for the Farrow filter length (N) parameter.
The Variable Fractional Delay block assumes that the input values at the Delay port are between Dmin and Dmax, where Dmin appears in the Valid delay range section on the Main pane of the block mask, and Dmax is the value of the Maximum delay (Dmax) in samples parameter. The block clips delay values less than Dmin to Dmin and delay values greater than Dmax to Dmax.
If you are working with frame-based signals and select the Disable direct feedthrough by increasing the minimum possible delay by one check box, the smallest possible delay value is increased by frame-size – 1. Thus, all input delay values less than Dmin + frame-size – 1 are clipped to Dmin + frame-size – 1.
You must consider additional factors when selecting valid Delay values for the FIR and Farrow interpolation modes. For more information about these considerations, refer to FIR Interpolation Mode or Farrow Interpolation Mode, respectively.
The Variable Fractional Delay block is similar to the Variable Integer Delay block, in that they both store a minimum of Dmax+1 past samples in memory. The Variable Fractional Delay block differs only in the way that these stored samples are accessed; a fractional delay requires the computation of a value by interpolation from the nearby samples in memory.
For sample-based inputs, the block treats each element of the N-D input array, u, as an independent channel. The input to the Delay port, v, must either be an N-D array of the same size and dimension as the input u, or be a scalar value, such that Dmin ≤ v ≤ Dmax.
For example, consider an M-by-N input matrix. The block treats each of the M*N matrix elements as independent channels. The input to the Delay port can be an M-by-N matrix of floating-point values in the range Dmin ≤ v ≤ Dmax that specifies the number of sample intervals to delay each channel of the input, or it can be a scalar floating-point value, Dmin ≤ v ≤ Dmax, by which to equally delay all channels.
The block treats a 1-D vector input as an M-by-1 matrix, and outputs a 1-D vector.
The Initial conditions parameter specifies the values in the block's memory at the start of the simulation in the same manner as the Variable Integer Delay block. See the Variable Integer Delay block reference page for more information.
For frame-based inputs, the block treats each of the N input columns as a frame containing Mi sequential time samples from an independent channel.
The input to the Delay port, v, contains floating-point values that specify the number of sample intervals to delay the current input. When you clear the Disable direct feedthrough by increasing minimum possible delay by one check box, the valid range of delay values is Dmin ≤ v ≤ Dmax . When you select the Disable direct feedthrough by increasing minimum possible delay by one check box, the valid range of delay values is Dmin + frame-size – 1 ≤ v ≤ Dmax.
The input to the Delay port can be a scalar value to uniformly delay every sample in every channel. It can also be a column-based length-M vector, containing one delay for each sample in the input frame. The block applies the set of delays contained in the vector identically to every channel of a multichannel input. The Delay port entry can also be a row-based length-N vector, containing one delay for each channel. Finally, the Delay port entry can be an M-by-N matrix, containing a different delay for each corresponding element of the input.
For example, if v is the Mi-by-1 matrix [v(1) v(2) ... v(Mi)]', the earliest sample in the current frame is delayed by v(1) fractional sample intervals, the following sample in the frame is delayed by v(2) fractional sample intervals, and so on. The block applies the set of fractional delays contained in v identically to every channel of a multichannel input.
The Initial conditions parameter specifies the values in the block's memory at the start of the simulation in the same manner as the Variable Integer Delay block. See the Variable Integer Delay block reference page for more information.
The delay value specified at the Delay port serves as an index into the block's memory, U, which stores, at a minimum, the Dmax+1 most recent samples received at the In port for each channel. For example, an integer delay of 5 on a scalar input sequence retrieves and outputs the fifth most recent input sample from the block's memory, U(6). The block computes fractional delays by interpolating between stored samples; the three available interpolation modes are Linear, FIR and Farrow.
For noninteger delays, at each sample time, the Linear Interpolation mode uses the two samples in memory nearest to the specified delay to compute a value for the sample at that time. If v is the specified fractional delay for a scalar input, the output sample, y, is computed as follows.
vi = floor(v) % vi = integer delay vf = v-vi % vf = fractional delay y = (1-vf)*U(vi+1) + vf*U(vi)
In FIR Interpolation mode, the block provides a discrete set of fractional delays described by:
![]()
If v is less than P-1, the block's behavior depends on the setting of the For small input delay values parameter. You can specify the block's behavior when the input delay value is too small to center the kernel (less than P-1), by setting the For small input delay values parameter:
If you select Clip to the minimum value necessary for centered kernel, the block remains in FIR interpolation mode by clipping small input delay values to the smallest value necessary to center the kernel.
To determine the minimum delay value, select Clip to the minimum value necessary for centered kernel, and click Apply on the block mask. All input delay values less than the value displayed for Dmin will be clipped to Dmin.
If you select Switch to linear interpolation if kernel cannot be centered, the block computes fractional delays using linear interpolation when the input delay value is less than P-1.
To add an extra delay to the minimum possible delay value, select the Disable direct feedthrough by increasing minimum possible delay by one check box. Checking this box prevents algebraic loops from occurring when you use the block inside a feedback loop.
Note If the input to the block is frame based and you select the Disable direct feedthrough by increasing minimum possible delay by one check box, the minimum possible delay (Dmin) increases by frame-size – 1. |
In FIR Interpolation mode, the block implements a polyphase structure to compute a value for each sample at the desired delay. Each arm of the structure corresponds to a different delay value and the output computed for each sample corresponds to the output of the arm with a delay value nearest to the desired input delay. Thus, only a discrete set of delays is actually possible. The number of coefficients in each of the L filter arms of the polyphase structure is 2P. In most cases, using values of P between 4 and 6 will provide you with reasonably accurate interpolation values.
In this mode, the Signal Processing Toolbox intfilt function computes an FIR filter for interpolation.
For example, when you set the parameters on the block mask to the following values:
Interpolation filter half-length (P): 4
Interpolation points per input sample: 10
Normalized input bandwidth: 1
The filter coefficients are given by:
b = intfilt(10,4,1);
The block then implements this filter as a polyphase structure, as described previously.
Increasing the Interpolation filter half length (P) increases the accuracy of the interpolation, but also increases the number of computations performed per input sample, as well as the amount of memory needed to store the filter coefficients. Increasing the Interpolation points per input sample (L) increases the number of representable discrete delay points, but also increases the simulation's memory requirements and does not affect the computational load per sample.
The Normalized input bandwidth (0 to 1) parameter allows you to take advantage of the bandlimited frequency content of the input. For example, if you know that the input signal does not have frequency content above Fs/4, you can specify a value of 0.5 for the Normalized input bandwidth (0 to 1) to constrain the frequency content of the output to that range.
Note You can consider each of the L interpolation filters to correspond to one output phase of an "upsample-by-L" FIR filter. Thus, the Normalized input bandwidth (0 to 1) value improves the stopband in critical regions, and relaxes the stopband requirements in frequency regions where there is no signal energy. |
In Farrow interpolation mode, the block uses the LaGrange method to interpolate values.
To add an extra delay of 1 to the minimum possible delay value, select the Disable direct feedthrough by increasing minimum possible delay by one check box. Checking this box prevents algebraic loops from occurring when you use the block inside a feedback loop.
Note If the input to the block is frame-based and you select the Disable direct feedthrough by increasing minimum possible delay by one check box, the minimum possible delay (Dmin) increases by frame-size – 1. |
To specify the block's behavior when the input delay value is
too small to center the kernel (less than
-1), set the For
small input delay values parameter:
If you select Clip to the minimum value necessary for centered kernel, the block clips small input delay values to the smallest value necessary to keep the kernel centered. This increases Dmin but yields more accurate interpolation values.
To determine the minimum delay value, select Clip to the minimum value necessary for centered kernel, and click Apply on the block mask. All input delay values less than the value displayed for Dmin will be clipped to Dmin.
If you select Use off-centered kernel,
the block computes fractional delays using a Farrow filter with an
off-centered kernel. This mode does not increase Dmin,
but if there are input delay values less than
-1, the results are
less accurate than the results achieved by keeping the kernel centered.
The diagrams in the following sections show the data types used within the Variable Fractional Delay block for fixed-point signals.
Although you can specify most of these data types on the Fixed-point pane of the block mask, the following data types are computed internally by the block and cannot be directly specified on the block mask.
| Data Type | Word Length | Fraction Length |
|---|---|---|
| vf data type | Same word length as the Coefficients | Same as the word length |
| HoldInteger data type | Same word length as the input delay value | 0 bits |
| Integer data type | 32 bits | 0 bits |
To compute the integer (vi) and fractional (vf) parts of the input delay value (v), the Variable Fractional Delay block uses the following equations:

The following diagram shows the fixed-point data types used by the Linear interpolation mode of the Variable Fractional Delay block.

The following diagram illustrates how the Variable Fractional Delay block selects the arm of the polyphase filter structure that most closely matches the fractional delay value (vf).

See the Fixed-Point Data Types section of the FIR Interpolation reference page for a diagram showing the fixed-point data types used by the Variable Fractional Delay block in FIR interpolation mode.
The following diagram shows the fixed-point data types used by the Farrow interpolation mode of the Variable Fractional Delay block where:
Farrow filter length (N) = 4
For small input delay values = Clip to the minimum value necessary to for centered kernel

The following diagram shows the fixed-point data types used by the Farrow interpolation mode of the Variable Fractional Delay block where:
Farrow filter length (N) = 4
For small input delay values = Use off-centered kernel

Diff is computed from the integer part of the delay value (vi) and the Farrow filter length (N) according to the following equation:

The following diagram shows the fixed-point data types used by the Digital Filter block's FIR direct form filter.

The dspaudioeffects demo illustrates three audio effects applied to a short segment of music. When you set the Audio effect of the Effect block to Flanging, the model uses the Variable Fractional Delay block to mix the original signal with a delayed version of itself.
To see the Flanging subsystem, right-click the Effect block, and select Look Under Mask. Next, double-click the Flanging block in the Effect block subsystem that just opened. The Flanging subsystem opens, and you can see the parameters of the Variable Fractional Delay block.
The Main pane of the Variable Fractional Delay block dialog appears as follows.

The method by which to interpolate between adjacent stored samples to obtain a value for the sample indexed by the input at the Delay port.
Half the number of input samples to use in the FIR interpolation filter. This parameter is only visible when the Interpolation mode is set to FIR.
The number of input samples to use in the Farrow interpolation filter. This parameter is only visible when the Interpolation mode is set to Farrow.
The number of points per input sample, L, at which a unique FIR interpolation filter is computed. This parameter is only visible when the Interpolation mode is set to FIR.
The bandwidth to which the interpolated output samples should be constrained. The value must be a real scalar between 0 and 1. A value of 1 specifies half the sample frequency. This parameter is only visible when the Interpolation mode is set to FIR.
The values with which the block's memory is initialized. See the Variable Integer Delay block for more information.
The maximum delay that the block can produce, Dmax. Input delay values exceeding this maximum are clipped to Dmax.
Select this box to disable direct feedthrough by adding one to the minimum possible delay value. Checking this box allows the Variable Fractional Delay block to be used in feedback loops.
Specify the block's behavior when the input delay values are too small to center the kernel. This parameter is only visible when the Interpolation mode is set to FIR or Farrow.
You can specify how the block handles input delay values that are too small for the kernel to be centered using one of the following choices:
In both FIR and Farrow interpolation modes, you can select Clip to the minimum value necessary for centered kernel. This option forces the block to increase Dmin to the smallest value necessary to keep the kernel centered.
In FIR interpolation mode, you can select Switch to linear interpolation if kernel cannot be centered. This option forces the block to preserve the value of Dmin and compute all interpolated values using Linear interpolation.
In Farrow interpolation mode, you can select Use off-centered kernel. This option forces the block to preserve the value of Dmin and compute the interpolated values using a farrow filter with an off-centered kernel.
The values displayed in this section of the Main pane are calculated (in samples) by the block based on the current parameter settings. To update the values displayed in this section after changing parameter values on the block mask, click Apply.
Dmin is the smallest possible valid delay value (in samples) based on the current settings of the block parameters. All input delay values less than Dmin are clipped to Dmin.
Dmax is the maximum valid delay value (in samples) based on the current settings of the block parameters. All input delay values greater than Dmax are clipped to Dmax.
The Fixed-point pane of the Variable Fractional Delay block dialog appears as follows.

Select the rounding mode for fixed-point operations.
Select the overflow mode for fixed-point operations.
Choose how you specify the word length and fraction length of the filter coefficients.
When you select Same word length as input, the word length of the filter coefficients match that of the input to the block. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.
When you select Specify word length, you can enter the word length of the coefficients, in bits. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.
Use this parameter to specify how you would like to designate the product output word and fraction lengths. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of zero.
Use this parameter to specify how you would like to designate the accumulator word and fraction lengths. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the accumulator data type in this block:
When you select Same as product output, these characteristics match those of the product output.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of zero.
Choose how you specify the output word length and fraction length:
When you select Same as accumulator, these characteristics match those of the accumulator.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. This block requires power-of-two slope and a bias of zero.
Choose how you specify the word length and fraction length of the product output polyval data type. This parameter is only visible when the Interpolation mode is set to Farrow.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output polyval in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output polyval. This block requires power-of-two slope and a bias of zero.
Choose how you specify the word length and fraction length of the accumulator polyval data type. This parameter is only visible when the Interpolation mode is set to Farrow.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator polyval in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator polyval. This block requires power-of-two slope and a bias of zero.
Choose how you specify the word length and fraction length of the multiplicand polyval data type. This parameter is only visible when the Interpolation mode is set to Farrow.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the multiplicand polyval, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the multiplicand polyval. This block requires power-of-two slope and a bias of zero.
Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling feature of the Fixed-Point Tool. See the fxptdlg reference page for more information.
| Port | Supported Data Types |
|---|---|
Input |
|
Delay |
|
Output |
|
| Delay | Signal Processing Blockset |
| Unit Delay | Simulink |
| Variable Integer Delay | Signal Processing Blockset |
![]() | Upsample | Variable Integer Delay | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |