| Signal Processing Blockset™ | ![]() |
Signal Operations
dspsigops
The Variable Fractional Delay block delays each element of the N-D input array, u, by a variable (possibly noninteger) number of sample intervals.
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 Mode parameter. In Linear Interpolation mode, the block stores the D+1 most recent samples received at the In port for each channel, where D is the Maximum delay. In FIR Interpolation mode, the block stores the D+P+1 most recent samples received at the In port for each channel, where P is the Interpolation filter half-length.
The block assumes that the input values at the Delay port are between 0 and D, where D is the value of the Maximum delay parameter on the block mask. Delay values less than 0 are clipped to 0, and delay values greater than D are clipped to D. If you use FIR Interpolation mode, you must consider additional factors when selecting valid Delay values. For more information about these considerations, refer to the section on the FIR Interpolation Mode.
The Variable Fractional Delay block is similar to the Variable Integer Delay block, in that they both store a minimum of D+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 0 ≤ v ≤ D.
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 0 ≤ v ≤ D that specifies the number of sample intervals to delay each channel of the input, or it can be a scalar floating-point value, 0 ≤ v ≤ D, 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 in the range 0 ≤ v ≤ D that specify the number of sample intervals to delay the current input. 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 the D+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 two available interpolation modes are Linear and FIR.
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:
![]()
Note If the input delay is less than P-1, the block defaults to linear interpolation mode. |
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: 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 (Q) 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 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 to constrain the frequency content of the output to that range.
Note You can consider each of the Q interpolation filters to correspond to one output phase of an "upsample-by-Q" FIR filter. Thus, the Normalized input bandwidth value improves the stopband in critical regions, and relaxes the stopband requirements in frequency regions where there is no signal energy. |
Note When you use the Variable Fractional Delay block in a feedback loop, include in the loop at least one block with a nonzero delay (for example, a Delay block with Delay > 0). Including a nonzero delay prevents an algebraic loop from occurring when the delay of the Variable Fractional Delay block is driven to zero. |
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 method by which to interpolate between adjacent stored samples to obtain a value for the sample indexed by the input at the Delay port.
The maximum delay that the block can produce, D. Delay input values exceeding this maximum are clipped at the maximum.
Half the number of input samples to use in the FIR interpolation filter.
The number of points per input sample, Q, at which a unique FIR interpolation filter is computed.
The bandwidth to which the interpolated output samples should be constrained. A value of 1 specifies half the sample frequency.
The values with which the block's memory is initialized. See the Variable Integer Delay block for more information.
Double-precision floating point
Single-precision floating point
| Delay | Signal Processing Blockset |
| Fractional Delay Filter | Signal Processing Blockset |
| Unit Delay | Simulink |
| Variable Integer Delay | Signal Processing Blockset |
![]() | Upsample | Variable Integer Delay | ![]() |
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |