Interpolate values of real input samples
Signal Operations
dspsigops
The Interpolation block interpolates discrete, real, inputs using linear or FIR interpolation. The block accepts vector, matrix, or an ND array. The block outputs a scalar, vector, matrix, or ND array of the interpolated values.
You must specify the interpolation points (times at which to interpolate values) in a onebased interpolation array, I_{Pts}. An entry of 1 in I_{Pts} refers to the first sample of the input data, an entry of 2.5 refers to the sample halfway between the second and third input sample, and so on. Depending on the dimensions of the input data, I_{Pts} can be a scalar, a lengthP row or column vector, a PbyN matrix, or an ND array where P is the size of the first dimension of the ND array. In most cases, P can be any positive integer. For more information about valid interpolation arrays, refer to the tables in How the Block Applies Interpolation Arrays to Inputs.
In most cases, the block applies I_{Pts} across the first dimension of an ND input array, or to each input vector. You can set the block to apply the same interpolation array for all input data (static interpolation points entered on the block mask) or to use a different interpolation array for each ND array, matrix, or vector input (timevarying interpolation points received via the Pts input port).
To supply the block with a static interpolation array (an interpolation array applied to every vector or ND array of input data), perform the following steps:
Set the Source of interpolation points parameter
to Specify via dialog
.
Enter the interpolation array in the Interpolation points parameter. To learn about interpolation arrays, see How the Block Applies Interpolation Arrays to Inputs.
To supply the block with timevarying interpolation arrays (where the block uses a different interpolation array for each vector or ND array input), perform the following steps:
Set the Source of interpolation
points parameter to Input port
,
the Pts port appears on the block.
Generate a signal of interpolation arrays, and supply it to the Pts port. The block uses the input to this port as the interpolation points. To learn about interpolation arrays, see How the Block Applies Interpolation Arrays to Inputs.
The interpolation array I_{Pts} represents the points in time at which to interpolate values of the input signal. An entry of 1 in I_{Pts} refers to the first sample of the input, an entry of 2.5 refers to the sample halfway between the second and third input sample, and so on. In most cases, when I_{Pts} is a vector, it can be of any length.
Valid values in the interpolation array, I_{Pts}, range from 1 to the number of samples in each channel of the input. To learn how the block handles out of range interpolation values, see Handling OutofRange Interpolation Points.
Depending on the dimension of the input and the dimension of I_{Pts}, the block usually applies I_{Pts} to the input in one of the following ways:
Applies the I_{Pts} array across the first dimension of an ND array, resulting in an ND array output.
Applies the vector I_{Pts} to each input vector (as if the input vector were a single channel), resulting in a vector output with the same orientation as the input (row or column).
The following tables summarize how the block applies the interpolation array I_{Pts} to all the possible types of inputs, and show the resulting output dimensions.
The first table describes the block's behavior when the Source of interpolation
points is Specify via dialog
.
Input Dimensions  Valid Dimensions of Interpolation Array I_{Pts}  How Block Applies I_{Pts} to Input  Output Dimensions (Frame Based) 

MbyNbyK matrix 
Pby1 column 
Applies I_{Pts} to the first dimension of the input. 
PbyNbyK array 
PbyNbyK matrix 
Applies each column of I_{Pts} (each element of I_{Pts}) to the corresponding column of the input matrix 
PbyNbyK array  
MbyN matrix 
1byN row 
Applies each column of I_{Pts} (each element of I_{Pts}) to the corresponding column of the input matrix 
1byN row 
Pby1 column 
Applies I_{Pts} to each input column 
PbyN matrix  
PbyN matrix 
Applies the columns of I_{Pts} to the corresponding columns of the input matrix  
Mby1 column 
1byP row (the algorithm treats I_{Pts} as a column) 
Applies I_{Pts} to the input column 
Pby1 column 
Pby1 column  
1byN row (not recommended) 
1byN row 
Not Applicable. Block copies input vector 
1byN row, a copy of the input vector 
Pby1 column 
PbyN matrix where each row is a copy of the input vector  
PbyN matrix 
The next table describes the block's behavior when the Source of interpolation
points is Input port
.
Input Dimensions  Valid Dimensions of Interpolation Array I_{Pts}  How Block Applies I_{Pts} to Input  Output Dimensions (Frame Based) 

MbyNbyK matrix  Unoriented vector or column vector of length P 
Applies I_{Pts} to the first dimension of the input. 
PbyNbyK array 
PbyNbyK matrix 
Applies each column of I_{Pts} (each element of I_{Pts}) to the corresponding column of the input matrix 
PbyNbyK array  
MbyN matrix 
1byN row 
Applies each column of I_{Pts} (each element of I_{Pts}) to the corresponding column of the input matrix 
1byN row 
Pby1 column 
Applies I_{Pts} to each input column 
PbyN matrix  
PbyN matrix 
Applies the columns of I_{Pts} to the corresponding columns of the input matrix  
Mby1 column 
1byP row 
Applies I_{Pts} to the input column 
Pby1 column 
Pby1 column  
1byN row (not recommended) 
1byN row 
Not Applicable. Block copies input vector 
1byN row, a copy of the input vector 
Pby1 column 
PbyN matrix where each row is a copy of the input vector  
PbyN matrix 
Valid values in the interpolation array I_{Pts} range
from 1 to the number of samples in each channel of the input. For
instance, given a length5 input vector D
, all
entries of I_{Pts} must range
from 1 to 5. I_{Pts} cannot
contain entries such as 7 or 9, since there is no 7th or 9th entry
in D
.
The Out of range interpolation points parameter sets how the block handles interpolation points that are fall outside the valid range, and has the following settings:
Clip
— The block
replaces any outofrange values in I_{Pts} with
the closest value in the valid range (from 1 to the number of input
samples), and then proceeds with computations using the clipped version
of I_{Pts}.
Clip and warn
—
In addition to Clip
, the block issues a
warning at the MATLAB^{®} command line every time clipping occurs.
Error
— When the
block encounters an outofrange value in I_{Pts},
the simulation stops, and the block issues an error at the MATLAB command
line.
Suppose the block is set to clip outofrange interpolation points, and gets the following input vector and interpolation points:
D = [11 22 33 44]'
I_{Pts} = [10 2.6 3]'
Because D has four samples, valid interpolation
points range from 1 to 4. The block clips the interpolation point
10 to 4 and the point 3 to 1, resulting in the clipped interpolation
vector I_{PtsClipped} = [4 2.6 1]'
.
When Interpolation Mode is set to Linear
,
the block interpolates data values by assuming that the data varies
linearly between samples taken at adjacent sample times.
For instance, if the input signal D = [1 2 1.5 3 0.25]', the following plot on the left shows the samples in D, and the plot on the right shows the linearly interpolated values between the samples in D.
The following figure illustrates the case of a block in linear interpolation mode that is set to clip outofrange interpolation points. The vector D supplies the input data and the vector I_{Pts} supplies the interpolation points:
D = [1 2 1.5 3 0.25]'
I_{Pts} = [4 2.7 4.3
10]'
The block clips the invalid interpolation points, and outputs
the linearly interpolated values in a vector, [1 1.65 2.175
0.25]'
.
When Interpolation Mode is set to
FIR
, the block interpolates data values using an FIR
interpolation filter, specified by various block parameters. See FIR Interpolation Mode in the
Variable Fractional Delay block reference for more
information.
Choose how you want to specify the interpolation points. If
you select Specify via dialog
, the Interpolation
points parameter become available. Use this option for
static interpolation points. If you select Input port
,
the Pts port appears on the block. The block uses the input to this
port as the interpolation points. Use this option for timevarying
interpolation points. For more information, see Specifying Static Interpolation Points and Specifying TimeVarying Interpolation Points.
The array of points in time at which to interpolate the input signal (I_{Pts}). An entry of 1 in I_{Pts} refers to the first sample of the input, an entry of 2.5 refers to the sample halfway between the second and third input sample, and so on. See How the Block Applies Interpolation Arrays to Inputs. Tunable (Simulink).
Sets the block to interpolate by either linear or FIR interpolation. For more information, see Linear Interpolation Mode and FIR Interpolation Mode.
Specify the halflength of the FIR interpolation filter (P
).
To perform the interpolation in FIR
mode, the block
uses the nearest 2*P
lowrate samples. In most
cases, P
lowrate samples must appear below and
above each interpolation point. However, if you interpolate at a lowrate
sample point, the block includes that lowrate sample in the required
2*P
samples and requires only 2*P
–1
neighboring lowrate samples. If an interpolation point does not have
the required number of neighboring lowrate samples, the block interpolates
that point using linear interpolation.
This parameter becomes available only when the Interpolation
mode is set to FIR
. For more
information, see FIR Interpolation Mode.
Also known as the upsampling factor,
this parameter defines the number of points per input sample (L
)
at which the block computes a unique FIR interpolation filter. To
perform the FIR Interpolation, the block uses a polyphase structure
with L
filter arms of length 2*P
.
For example, if L
=4
, the block constructs a polyphase
filter with four arms. The block then interpolates at points corresponding
to 1 +i/L
, 2
+i/L
, 3
+i/L
..., where the integers 1, 2, and 3 represent the lowrate
samples, and i=0,1,2,3
. To interpolate
at a point that does not directly correspond to an arm of the polyphase
filter requires an extra computation. The block first rounds that point down
to the nearest value that does correspond to an arm of the polyphase filter.
Thus, to interpolate at the point 2.2, the block rounds 2.2 down to 2, and
computes the FIR interpolation using the first arm of the polyphase filter
structure. Similarly, to interpolate the point 2.65, the block rounds the
value down to 2.5 and uses the third arm of the polyphase filter
structure.
This parameter becomes available only when the Interpolation
mode is set to FIR
. For more
information, see FIR Interpolation Mode.
The bandwidth of the input divided by Fs/2 (half the input sample frequency).
This parameter is only available when the Interpolation
mode is set to FIR
. For more
information, see FIR Interpolation Mode.
When an interpolation point is out of range, this parameter sets the block to either clip the interpolation point, clip the value and issue a warning at the MATLAB command line, or stop the simulation and issue an error at the MATLAB command line. For more information, see Handling OutofRange Interpolation Points.
Port  Supported Data Types 

In 

Pts 

Out 
