Variable Fractional Delay
Delay input by timevarying fractional number of sample periods
Libraries:
DSP System Toolbox /
Signal Operations
Description
The Variable Fractional Delay block delays the input signal by a specified number of fractional samples along each channel of the input. The block can also concurrently compute multiple delayed versions (taps) of the same signal. For an example, see Delay Signal Using Multitap Fractional Delay.
When the delay has a fractional value, the block interpolates the input signal to
obtain new samples at noninteger sampling intervals. You can set Interpolation
mode parameter to one of Linear
,
FIR
, or Farrow
. The block
supports timevarying delay values. That is, the delay value can vary within a frame
from sample to sample.
The block assumes that the input values at the Delay port are
between D_{min} and
D_{max}, where
D_{min} appears in the Valid
delay range
section on the Main tab of the block
dialog, and D_{max} is the value of the
Maximum delay (Dmax) in samples parameter. The block clips
delay values less than D_{min} to
D_{min} and delay values greater than
D_{max} to
D_{max}.
You must consider additional factors when selecting valid
Delay
values for the FIR
and
Farrow
interpolation modes. For details, see Algorithms.
Examples
Delay Signal Using Multitap Fractional Delay
Concurrently delay an input signal using multiple taps.
Ports
Input
In — Data input
vector  matrix
Specify the data input as a vector or matrix. The data input must have the same data type as the delay input.
This block supports variablesize input signal. That is, you can change the number of input rows during the simulation. However, the number of channels must remain constant.
Example: [1 2 3 4;5 1 4 2;2 6 2 3;1 2 3 2;3 4 5 6;1 2 3 1]
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 fixed point
Complex Number Support: Yes
Delay — Delay input
scalar  vector  matrix  ND array
Specify the delay input in samples as a scalar, vector, matrix, or ND array. The delay can be an integer or a fractional value. The block interpolates the signal to obtain new samples at noninteger sampling intervals. The delay input must have the same data type as the data input.
The block dialog box displays the valid delay range in samples. The
block determines this range based on the settings in the block dialog
box. If you specify a delay value that is less than the minimum
acceptable value, the block performs the action you choose in the
For small input delay values parameter. If you
set the Interpolation mode to
Linear
, the minimum acceptable value is
0.
If you specify a delay value that is greater than the maximum acceptable value, the block clips the delay value to the maximum value.
This block supports variablesize delay signal. That is, you can change one or both of the dimensions of the delay signal during simulation. However, the block must make sure that the resulting number of output channels remains constant throughout the simulation.
When the Input processing parameter is set to
Columns as channels (frame based)
, the
table below shows the effect of the dimension of the delay input on the
data input. For an example, see Delay Signal Using Multitap Fractional Delay.
Data Input  Delay Input  Output  Effect of Delay Input on Data Input 

N (unoriented, one channel)  scalar  Unoriented (N)  One delay value applied to the input channel 
N (unoriented, one channel)  Unoriented (N)  Unoriented (N)  Delay value varies within the frame from sample to sample 
N (unoriented, one channel)  1byP  NbyP  P taps. Each column in the output is a delayed version of the input. The delay value is specified by the corresponding element in the delay input vector. 
N (unoriented, one channel)  NbyP  NbyP  P taps. In addition, delay varies within each frame from sample to sample. 
Nby1 (one channel with frame size equal to N)  scalar  Nby1  One delay value applied to the input channel 
Nby1 (one channel with frame size equal to N)  Unoriented (N)  Nby1  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  Nby1  Nby1  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  1byP  NbyP  P taps. Each column in the output is a delayed version of the input. The delay value is specified by the corresponding element in the delay input vector. 
Nby1 (one channel with frame size equal to N)  NbyP  NbyP  P taps. In addition, delay varies within each frame from sample to sample. 
NbyL (L channels with frame size equal to N)  scalar  NbyL  One delay value applied to all input channels 
NbyL (L channels with frame size equal to N)  1byL  NbyL  Unique delay value for each input channel 
NbyL (L channels with frame size equal to N)  Nby1  NbyL  Delay value varies within the frame from sample to sample. Same set of delay values for all channels. 
NbyL (L channels with frame size equal to N)  NbyL  NbyL  Delay value varies within the frame from sample to sample. Different delay values for each input channel. 
NbyL (L channels with frame size equal to N)  1by1byP  NbyLbyP  L channels. P taps per channel. Same delay for all channels. 
NbyL (L channels with frame size equal to N)  1byLbyP  NbyLbyP  L channels. P taps per channel. Taps vary across channels. 
NbyL (L channels with frame size equal to N)  Nby1byP  NbyLbyP  L channels. P taps per channel. Delay varies within the frame from sample to sample. Same set of delay values for each channel. 
NbyL (L channels with frame size equal to N)  NbyLbyP  NbyLbyP  L channels. P taps per channel. Delay varies within the frame from sample to sample. Different set of delay values for each channel. 
When the Input processing parameter is set to
Elements as channels (sample based)
, the
table below shows the effect of the dimension of the delay input on the
data input.
Data Input  Delay Input  Output  Effect of Delay Input on Data Input 

N (unoriented, one channel)  scalar  Unoriented (N)  One delay value applied to the input channel 
N (unoriented, one channel)  Unoriented (N)  Unoriented (N)  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  scalar  Nby1  One delay value applied to the input channel 
Nby1 (one channel with frame size equal to N)  Unoriented (N)  Nby1  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  Nby1  Nby1  Delay value varies within the frame from sample to sample 
NbyL (L channels with N samples in each channel)  scalar  NbyL  One delay value applied to all input channels 
NbyL (L channels with N samples in each channel)  1byL  NbyL  Unique delay value for each input channel 
NbyL (L channels with N samples in each channel)  Nby1  NbyL  Delay value varies within the frame from sample to sample. Same set of delay values for all channels. 
NbyL (L channels with N samples in each channel)  NbyL  NbyL  Delay value varies within the frame from sample to sample. Different delay values for each input channel. 
Example: [2 3 4 5]
Example: [2.5]
Example: [5.6]
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 fixed point
Output
Port_1 — Delayed output
vector  matrix
Delayed output, returned as a vector or matrix. The data type and complexity of the output match the data type and complexity of the data input.
When the Input processing parameter is set to
Columns as channels (frame based)
, the
table below shows the effect of the dimension of the delay input on the
data input.
Data Input  Delay Input  Output  Effect of Delay Input on Data Input 

N (unoriented, one channel)  scalar  Unoriented (N)  One delay value applied to the input channel 
N (unoriented, one channel)  Unoriented (N)  Unoriented (N)  Delay value varies within the frame from sample to sample 
N (unoriented, one channel)  1byP  NbyP  P taps. Each column in the output is a delayed version of the input. The delay value is specified by the corresponding element in the delay input vector. 
N (unoriented, one channel)  NbyP  NbyP  P taps. In addition, delay varies within each frame from sample to sample. 
Nby1 (one channel with frame size equal to N)  scalar  Nby1  One delay value applied to the input channel 
Nby1 (one channel with frame size equal to N)  Unoriented (N)  Nby1  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  Nby1  Nby1  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  1byP  NbyP  P taps. Each column in the output is a delayed version of the input. The delay value is specified by the corresponding element in the delay input vector. 
Nby1 (one channel with frame size equal to N)  NbyP  NbyP  P taps. In addition, delay varies within each frame from sample to sample. 
NbyL (L channels with frame size equal to N)  scalar  NbyL  One delay value applied to all input channels 
NbyL (L channels with frame size equal to N)  1byL  NbyL  Unique delay value for each input channel 
NbyL (L channels with frame size equal to N)  Nby1  NbyL  Delay value varies within the frame from sample to sample. Same set of delay values for all channels. 
NbyL (L channels with frame size equal to N)  NbyL  NbyL  Delay value varies within the frame from sample to sample. Different delay values for each input channel. 
NbyL (L channels with frame size equal to N)  1by1byP  NbyLbyP  L channels. P taps per channel. Same delay for all channels. 
NbyL (L channels with frame size equal to N)  1byLbyP  NbyLbyP  L channels. P taps per channel. Taps vary across channels. 
NbyL (L channels with frame size equal to N)  Nby1byP  NbyLbyP  L channels. P taps per channel. Delay varies within the frame from sample to sample. Same set of delay values for each channel. 
NbyL (L channels with frame size equal to N)  NbyLbyP  NbyLbyP  L channels. P taps per channel. Delay varies within the frame from sample to sample. Different set of delay values for each channel. 
When the Input processing parameter is set to
Elements as channels (sample based)
, the
table below shows the effect of the dimension of the delay input on the
data input.
Data Input  Delay Input  Output  Effect of Delay Input on Data Input 

N (unoriented, one channel)  scalar  Unoriented (N)  One delay value applied to the input channel 
N (unoriented, one channel)  Unoriented (N)  Unoriented (N)  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  scalar  Nby1  One delay value applied to the input channel 
Nby1 (one channel with frame size equal to N)  Unoriented (N)  Nby1  Delay value varies within the frame from sample to sample 
Nby1 (one channel with frame size equal to N)  Nby1  Nby1  Delay value varies within the frame from sample to sample 
NbyL (L channels with N samples in each channel)  scalar  NbyL  One delay value applied to all input channels 
NbyL (L channels with N samples in each channel)  1byL  NbyL  Unique delay value for each input channel 
NbyL (L channels with N samples in each channel)  Nby1  NbyL  Delay value varies within the frame from sample to sample. Same set of delay values for all channels. 
NbyL (L channels with N samples in each channel)  NbyL  NbyL  Delay value varies within the frame from sample to sample. Different delay values for each input channel. 
Example: [0 0 0 0;0 0 0 0;1 0 0 0;5 2 0 0;2 1 3 0;1 6 4 4]
Example: [0 0 0 0;0 0 0 0;0.5 1.0 1.5 2.0;3 1.5 3.5 3.0;3.5 3.5 3.0 2.5;1.5 4.0 2.5 2.5]
Example: [0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0.4 0.8 1.2 1.6]
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 fixed point
Complex Number Support: Yes
Parameters
Interpolation mode — Method of interpolation
Linear
(default)  FIR
 Farrow
Specify the method of interpolation. Using this method, the block interpolates the signal to obtain new samples at noninteger sampling intervals.
Linear
–– Linear interpolation. In this mode, the block stores the D_{max}+1 most recent samples the In port receives for each channel. D_{max} is the value you specify in the Maximum delay (Dmax) in samples parameter.FIR
–– Polyphase FIR interpolation. In this mode, the block stores the D_{max}+P+1 most recent samples the In port receives for each channel. P is the value you specify in the Interpolation filter halflength (P) parameter.Farrow
–– LaGrange method. In this mode, the block stores the D_{max}+$$\frac{N}{2}$$+1 most recent samples the In port receives for each channel. N is the value you specify in the Farrow filter length (N) parameter.
For more details on these methods, see Algorithms.
Interpolation filter halflength (P) — Half length of interpolation filter
4
(default)  positive integer in the range [1 65535]
Halflength of the FIR interpolation filter. For periodic signals, a larger value of this property, which indicates a higher order filter, yields a better estimate of the delayed output sample. A property value of 4 to 6, which corresponds to a 7thorder to 11thorder filter, is usually adequate.
Example: 6
Example: 10
Dependencies
This parameter applies only when you set Interpolation
mode to FIR
.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 Boolean
 fixed point
Interpolation points per input sample — Number of interpolation points per input sample
10
(default)  positive integer in the range [2, 65,535]
Number of interpolation points per input sample at which a unique FIR interpolation filter is computed.
Example: 20
Example: 5
Dependencies
This parameter applies only when you set Interpolation
mode to FIR
.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
Normalized input bandwidth (0 to 1) — Normalized input bandwidth
1
(default)  real scalar in the range (0, 1]
Normalized input bandwidth at which to constrain the interpolated output
samples. A value of 1
equals the Nyquist frequency, or
half the sampling frequency, Fs. Use this property to
take advantage of the bandlimited frequency content of the input. For
example, if the input signal does not have frequency content above
Fs/4, you can specify a value of
0.5
.
Example: 0.5
Example: 0.8
Dependencies
This parameter applies only when you set Interpolation
mode to FIR
.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 Boolean
 fixed point
Farrow filter length (N) — Length of Farrow filter
4
(default)  integer greater than or equal to 2
Length of the FIR filter implemented using the Farrow structure. If the length equals 2, the filter performs linear interpolation.
Example: 4
Example: 10
Dependencies
This parameter applies only when you set Interpolation
mode to Farrow
.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
Maximum delay (Dmax) in samples — Maximum delay
100
(default)  integer in the range [0 65535]
Maximum delay the block can produce, D_{max}. Input delay values exceeding this maximum are clipped to D_{max}.
Example: 200
Example: 500
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
Input processing — Method to process the input
Columns as channels (frame
based)
(default)  Elements as channels (sample based)
Specify how the block should process the input. You can set this parameter to one of the following options:
Columns as channels (frame based)
(default) — When you select this option, the block treats each column of the input as a separate channel. The block treats each of the R input columns as independent channels containing M_{i} sequential time samples.The input to the Delay port, v, contains floatingpoint values 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 lengthM column 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 lengthR row vector, containing one delay for each channel. Finally, the Delay port entry can be an MbyR matrix, containing a different delay for each corresponding element of the input.
For example, if v is the M_{i}by1 matrix
[v(1) v(2) ... v(Mi)]'
, the earliest sample in the current frame is delayed byv(1)
fractional sample intervals, the following sample in the frame is delayed byv(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.Elements as channels (sample based)
–– When you select this option, the block treats each element of the input as a separate channel. The block treats each element of the ND input array, u, as an independent channel. The input to the Delay port, v, must either be an ND array of the same size and dimension as the input u, or be a scalar value, such that D_{min} ≤ v ≤ D_{max}.For example, consider an MbyR input matrix. The block treats each of the M*R matrix elements as independent channels. The input to the Delay port can be an MbyR matrix of floatingpoint values in the range D_{min} ≤ v ≤ D_{max} that specifies the number of sample intervals to delay each channel of the input, or it can be a scalar floatingpoint value, D_{min} ≤ v ≤ D_{max}, by which to equally delay all channels.
In samplebased processing mode, the block treats an unoriented vector input as an Mby1 matrix. In this mode, the output is also an unoriented vector.
InitialConditions — Initial values in the memory
0
(default)  scalar  1byRbyD array  1byRby(D+L) array
Specify the values with in the block's memory at the start of the simulation. The dimensions of this parameter can vary depending on whether you want fixed or timevarying initial conditions. The block treats each of the R input columns as a frame containing M sequential time samples from an independent channel.
For an MbyR input matrix, u, you can set this parameter as follows:
To specify fixed initial conditions, set this parameter to a scalar value. The block initializes every sample of every channel in memory using the value you specify.
The dimensions you specify for timevarying initial conditions depend on the interpolation method. To specify different timevarying initial conditions for each channel, set this parameter as follows:
If you set the Interpolation mode to
Linear
, set the Initial conditions to an array of size1
byRbyD, where D is the value in Maximum delay (Dmax) in samples parameter.If you set the Interpolation mode to
FIR
orFarrow
, set the Initial conditions to an array of size 1byRby(D+L), where D is the value of the maximum delay. For FIR interpolation,L
is the value of the interpolation filter half length. For Farrow interpolation,L
equalsfloor
of half the value of the farrow filter length (floor( farrow filter length/2)
).
Example: 1
Example: randn(1,3,104)
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
Disable direct feedthrough by increasing minimum possible delay by one — Disable direct feedthrough
off
(default)  on
Select this box to disable direct feedthrough by increasing the minimum
possible delay value. When you set the Input processing
parameter to Columns as channels (frame based)
,
the block increases the minimum possible delay value by frame
size
– 1. Similarly, when you set the
Input processing parameter to Elements
as channels (sample based)
, the block increases the
minimum possible delay value by one sample.
Checking this box allows you to use the Variable Fractional Delay block in feedback loops.
For small input delay values — Action to take for small input delay values
Clip to the minimum value necessary for
centered kernel
(default)  Use offcentered kernel
 Switch to linear interpolation if kernel cannot be
centered
Specify the block's behavior when the input delay values are too small to center the kernel.
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
andFarrow
interpolation modes, you can selectClip to the minimum value necessary for centered kernel
. This option forces the block to increase D_{min} to the smallest value necessary to keep the kernel centered.In
FIR
interpolation mode, you can selectSwitch to linear interpolation if kernel cannot be centered
. This option forces the block to preserve the value of D_{min} and compute all interpolated values usingLinear
interpolation.In
Farrow
interpolation mode, you can selectUse offcentered kernel
. This option forces the block to preserve the value of D_{min} and compute the interpolated values using a farrow filter with an offcentered kernel.
Dependencies
This parameter applies only when Interpolation
mode is set to FIR
or
Farrow
.
Valid delay range (in samples) — Range of valid delay values
[0 100] (default)  [D_{min}
D_{max}]
This parameter is readonly.
The delay range values [D_{min} D_{max}] are calculated (in samples) by the block based on the current parameter settings. D_{min} is the smallest possible valid delay value (in samples). The block clips all input delay values less than D_{min} to D_{min}. D_{max} is the maximum valid delay value (in samples). The block clips all input delay values greater than D_{max} to D_{max}.
When the Interpolation mode is set to one of the following:
Linear
–– D_{min} equal 0. D_{max} equals the value you specify in the Maximum delay (Dmax) in samples parameter.FIR
–– D_{min} equals P – 1, where P is the value you specify in Interpolation filter halflength (P). D_{max} equals the value you specify in the Maximum delay (Dmax) in samples parameter.Farrow
–– D_{min} equals N/2 – 1, where N is the value you specify in Farrow filter length (N). D_{max} equals the value you specify in the Maximum delay (Dmax) in samples parameter.
Example: [1 100]
Example: [2 100]
Example: [3 100]
FixedPoint Properties
FixedPoint PropertiesRounding mode — Rounding method for fixedpoint operations
Zero
(default)  Ceiling
 Convergent
 Floor
 Nearest
 Round
 Simplest
Specify the rounding mode for fixedpoint operations as one of the following:
Zero
Ceiling
Convergent
Floor
Nearest
Round
Simplest
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 the coefficients
Same word length as
input
(default)  Specify word length
Specify the data type of the filter coefficients as one of the following:
Same word length as input
–– The word length of the filter coefficients matches that of the input to the block. The fraction length of the coefficients is automatically set to the binarypoint only scaling that provides you with the best precision possible given the value and word length of the coefficients.Specify word length
–– Specify the word length of the coefficients, in bits. In this mode, the fraction length of the coefficients is automatically set to the binarypoint only scaling that provides you with the best precision possible given the value and word length of the coefficients.
For more information on the coefficients data type this block uses, see the FixedPoint Data Types section.
Product output — Data type of the product output
Same as first input
(default)  Binary point scaling
Specify the data type of the product output as one of the following:
Same as first input
–– The block specifies the product output data type to be the same as that of the data input.Binary point scaling
–– Specify the word length and the fraction length of the product output, in bits.
For more information on the product output data type, see Multiplication Data Types and the FixedPoint Data Types section.
Accumulator — Data type of accumulation operation
Same as product
output
(default)  Same as first input
 Binary point scaling
Specify the data type of an accumulation operation as one of the following:
Same as product output
–– The block specifies the accumulator data type to be the same as that of the product output data type.Same as first input
–– The block specifies the accumulator data type to be the same as that of the data input.Binary point scaling
–– Specify the word length and the fraction length of the accumulator output, in bits.
For more information on the accumulator data type this block uses, see the FixedPoint Data Types section.
Product output polyval — Data type of the product polynomial value
Same as first input
(default)  Binary point scaling
Specify the data type of the product polynomial value as one of the following:
Same as first input
–– The block specifies the product polynomial value data type to be the same as that of the data input.Binary point scaling
–– Specify the word length and the fraction length of the product output polynomial, in bits.
For more information on the product polynomial value data type this block uses, see the FixedPoint Data Types section.
Dependencies
This property applies when you set Interpolation
mode to Farrow
.
Accumulator polyval — Data type of the accumulator polynomial value
Same as first input
(default)  Binary point scaling
Specify the data type of the accumulator polynomial value as one of the following:
Same as first input
–– The block specifies the accumulator polynomial value data type to be the same as that of the data input.Binary point scaling
–– Specify the word length and the fraction length of the accumulator polynomial value, in bits.
For more information on the accumulator polynomial value data type that this block uses, see the FixedPoint Data Types section.
Dependencies
This property applies when you set Interpolation
mode to Farrow
.
Multiplicand polyval — Data type of multiplicand polynomial value
Same as first input
(default)  Binary point scaling
Specify the data type of the multiplicand polynomial value as one of the following:
Same as first input
–– The block specifies the multiplicand polynomial value data type to be the same as that of the data input.Binary point scaling
–– Specify the word length and the fraction length of the multiplicand polynomial value, in bits.
For more information on the multiplicand polynomial value data type this block uses, see the FixedPoint Data Types section.
Dependencies
This property applies when you set Interpolation
mode to Farrow
.
Output — Data type of block output
Same as accumulator
(default)  Same as first input
 Binary point scaling
Specify the data type of the block output as one of the following:
Same as accumulator
–– The block specifies the output data type to be the same as that of the accumulator output data type.Same as first input
–– The block specifies the output data type to be the same as that of the data input.Binary point scaling
–– Specify the word length and the fraction length of the block output, in bits.
For more information on the output data type this block uses, see the FixedPoint Data Types section.
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 

More About
FixedPoint Data Types
The diagrams in the following sections show the data types used within the Variable Fractional Delay for fixedpoint signals.
Although you can specify most of these data types, the following data types are computed internally by the block and cannot be directly specified on the block dialog box.
Data Type  Word Length  Fraction Length 

v_{f} data type  Derived from the input to the Delay port. $$vfWL=\mathrm{max}\left(DelayWL,DelayFL+ceil\left(\mathrm{log}2\left(\text{filterHalfLength}\right)\right)\right)$$  Same as the fraction length of the input to the Delay port. $$vfFL=DelayFL$$ 
HoldInteger data type  Same word length as the input delay value  0 bits 
Integer data type  32 bits  0 bits 
Note
When the input is fixed point, all internal data types are signed fixed point.
To compute the integer (v_{i}) and fractional (v_{f}) parts of the input delay value (v), the Variable Fractional Delay block uses the following equations:
$$\begin{array}{l}{D}_{min}<v<{D}_{max}\Rightarrow \{\begin{array}{l}{v}_{i}\text{=}\mathrm{floor}\text{(}v\text{)}\\ {v}_{f}\text{=}vvi\end{array}\\ \\ v\text{}\le \text{}{D}_{min}\Rightarrow \{\begin{array}{l}{v}_{i}={D}_{min}\\ {v}_{f}=0\end{array}\\ \\ \text{}v\text{}\ge \text{}{D}_{max}\Rightarrow \{\begin{array}{l}{v}_{i}\text{=}{D}_{max}\\ {v}_{f}\text{=0}\end{array}\end{array}$$
The following diagram shows the fixedpoint 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 (v_{f}).
The following diagram shows the fixedpoint data types used by the variable fractional delay algorithm in the FIR interpolation mode.
You can set the coefficient, product output, accumulator, and output data types in the block. This diagram shows that input data is stored in the input buffer with the same data type and scaling as the input. The block stores filtered data and any initial conditions in the output buffer using the output data type and scaling that you set.
When at least one of the inputs to the multiplier is real, the output of the multiplier is in the product output data type. When both inputs to the multiplier are complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication, see Multiplication Data Types.
The following diagram shows the fixedpoint data types used by the Farrow interpolation mode when:
Farrow filter length is set to
4
Farrow small delay action is set to
Clip to the minimum value necessary for centered kernel
The following diagram shows the fixedpoint data types used by the Farrow interpolation mode when:
Farrow filter length is set to
4
.Farrow small delay action is set to
Use offcentered kernel
.
Diff
is computed from the integer part of the delay value
(v_{i}) and the farrow filter
length (N) according to the following equation:
$$\begin{array}{l}Diff={v}_{i}\left(\frac{N1}{2}\right)\\ Diff\ge 0\Rightarrow Diff=0\\ Diff<0\Rightarrow Diff=Diff\end{array}$$
The following diagram shows the fixedpoint data types used by the Digital Filter's FIR direct form filter.
Algorithms
The delay value specified at the Delay port serves as an index into the block's memory, U, which stores, at a minimum, the D_{max}+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 block uses a linear, FIR, or farrow interpolation method to interpolate signal values at noninteger sample intervals.
Linear Interpolation Mode
For noninteger delays, at each sample time, the linear interpolation method uses the two samples in memory nearest to the specified delay to compute a value for the sample at that time.
For a vector data input, the output vector, y, is computed using the following relation:
vi = floor(v) vf = vvi y(i) = U(ivi1)*vf + U(ivi)*(1vf)
where,
i –– Index of the current sample
v –– Fractional delay
vi –– Integer part of the delay
vf –– Fractional part of the delay
U –– Input data vector
y –– Output data vector
U(ivi), U(ivi1) –– Two samples in memory nearest to the specified delay
ivi –– Distance, in samples, between the current index and the nearest point in the interpolation line.
The variable fractional delay stores the Dmax+1 most recent samples received at the input for each channel, where Dmax is the maximum delay specified. U represents the stored samples.
FIR Interpolation Mode
In the FIR interpolation mode, the block stores the Dmax+P+1 most recent samples received at the input for each channel, where P is the specified interpolation filter halflength.
In this mode, the block provides a discrete set of fractional delays:
$$v+\frac{i}{L}\text{,}v\ge P1,\text{}i=0,1,\mathrm{...},L1$$
If v is less than P – 1, the behavior depends on 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 P1), by setting the For small input delay values parameter:
Clip to the minimum value necessary for centered kernel
–– The FIR interpolation method remains in use. The small input delay values are clipped to the smallest value necessary to center the kernel.Switch to linear interpolation if kernel cannot be centered
–– Fractional delays are computed using linear interpolation when the input delay value is less than P1.
In the FIR interpolation mode, the algorithm implements a polyphase structure to compute a value for each sample at the specified delay. Each arm of the structure corresponds to a different delay value. The output computed for each sample corresponds to the output of the arm with a delay value nearest to the specified input delay. Therefore, 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 provides you with reasonably accurate interpolation values.
The designMultirateFIR
function designs the FIR interpolation
filter.
For example, when you set the following values:
Interpolation filter halflength (P) to 4
Interpolation points per input sample to 10
Normalized input bandwidth to 1
Stopband attenuation to 80 dB
The filter coefficients are given by:
b = designMultirateFIR(10,1,4,80);
Increasing the filter half length (P) increases the accuracy of the interpolation, but also increases the number of computations performed per input sample. The amount of memory needed to store the filter coefficients increases too. Increasing the interpolation points per sample (L) increases the number of representable discrete delay points, but also increases the simulation's memory requirements. The computational load per sample is not affected.
The normalized input bandwidth from 0 to 1 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 F_{s}/4, you can
specify 0.5
normalized bandwidth 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 upsamplebyL FIR filter. Therefore, the normalized input value improves the stopband in critical regions and relaxes the stopband requirements in frequency regions without signal energy.
Farrow Interpolation Mode
In the farrow interpolation mode, the block stores the Dmax+N/2+1 most recent samples received at the input for each channel, where N is the specified farrow filter length.
The algorithm uses the LaGrange method to interpolate values.
To increase 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.
To specify the behavior when the input delay value is too small to center the kernel (less than $$\frac{N}{2}$$ – 1), use the Farrow small delay action setting.
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 D_{min} but yields more accurate interpolation values.Use offcentered kernel
–– The fractional delays are computed using a Farrow filter with an offcentered kernel. This mode does not increase D_{min}, but the results for input delay values less than $$\frac{N}{2}$$ – 1 are less accurate than the results achieved by keeping the kernel centered.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
FixedPoint Conversion
Design and simulate fixedpoint systems using FixedPoint Designer™.
Version History
Introduced before R2006a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)