Repeat
Resample input at higher rate by repeating values
Libraries:
DSP System Toolbox /
Signal Operations
Communications Toolbox /
Sequence Operations
DSP System Toolbox HDL Support /
Signal Operations
Description
The Repeat block upsamples each channel of the Mi-by-N input to a rate L times higher than the input sample rate. To do so, the block repeats each consecutive input sample L times at the output. Specify the integer L in the Repetition count, L parameter or through the input port L.
You can use the Repeat block in triggered subsystems when you set the
Rate options parameter to Enforce single-rate
processing.
Examples
Repeat Signal in Single-Rate Frame-Based Processing Mode
Repeat the signal in single-rate processing mode.
Repeat Signal in Multirate Frame-Based Processing Mode
Repeat the signal in multirate frame-based processing mode.
Ports
Input
Specify the input signal as a real or a complex-valued scalar, vector, or a matrix.
When you set Input processing to
Columns as channels (frame based) and
Rate options to Enforce
single-rate processing, the input can be a
variable-size signal. When the input is a variable-size signal, the
frame size (number of rows) and the number of channels (columns) of the
signal can change during simulation.
This port is unnamed until you
set Repetition count source to Input
port. (since R2023a)
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point
Complex Number Support: Yes
Since R2023a
Specify the repetition count L as a positive integer less than or equal to the value you specify in the Maximum repetition count, Lmax parameter Lmax.
Dependency
To enable this port, set the Repetition count
source parameter to Input
port.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Output
The Repeat block outputs a signal that has the same data type and complexity as the input signal in. The size of the output depends on the value of the repetition count and the option you select in the Rate options parameter.
If you set Repetition count, L to L and Rate options to:
Enforce single-rate processing— The block maintains the input sample rate by increasing the output frame size by a factor of L.Allow multirate processing— The block resamples the signal such that the output sample rate is L times faster than the input sample rate. The output signal has the same frame size as the input signal.
When you input the repetition
count through the input port L, the Rate
options parameter is automatically set to
Enforce single-rate processing. In this
case, the block maintains the input sample rate at the output by
increasing the output frame size by a factor of
L. (since R2023a)
The output is a variable-size signal when one or both of these conditions are met:
Input is a variable-size signal.
Repetition count is input through the port L.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point
Complex Number Support: Yes
Parameters
Since R2023a
Specify the repetition count through one of these options:
Dialog parameter— The block enables the Repetition count, L parameter in the block dialog box.Input port— The block enables the input port L through which you specify the repetition count.
Specify the repetition count L as a positive integer. This value is the number of times that the block repeats the input value. This is the factor by which the block increases the output frame size or sample rate.
Dependency
To enable this parameter, set
Repetition count source to Dialog
parameter. (since R2023a)
Since R2023a
Specify the maximum repetition Lmax as a positive
integer greater than or equal to 1. The repetition count
you specify through the input port L must be less than
or equal to Lmax.
Dependency
To enable this parameter, set Repetition count
source to Input port.
Specify how the block should process the input by setting this parameter to one of these options:
Columns as channels (frame based)— When you select this option, the block treats each column of the input as a separate channel. In this mode, the block can perform single-rate or multirate processing.Elements as channels (sample based)— When you select this option, the block treats each element of the input as a separate channel. In this mode, the block always performs multirate processing.
Dependency
To enable this parameter, set
Repetition count source to Dialog
parameter. (since R2023a)
When you set
Repetition count source to Input
port, the Input processing
parameter is automatically set to Columns as channels
(frame based). (since R2023a)
Specify the method by which the block upsamples the input by selecting one of these options:
Enforce single-rate processing— When you select this option, the block maintains the input sample rate by increasing the output frame size by a factor of L. To select this option, you must set the Input processing parameter toColumns as channels (frame based).Allow multirate processing— When you select this option, the block resamples the signal such that the output sample rate is L times faster than the input sample rate.
Dependency
To enable this parameter, set
Repetition count source to Dialog
parameter. (since R2023a)
When you set
Repetition count source to Input
port, the Rate options parameter
is automatically set to Enforce single-rate
processing. (since R2023a)
Specify the value with which the block is initialized for cases of nonzero latency as a scalar or a matrix.
Dependencies
To enable this parameter, set Rate options to Allow
multirate processing.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
More About
When you set the Input processing parameter to Columns as
channels (frame based), the block upsamples each column of the
input over time. In this mode, the block can perform either single-rate or multirate
processing. You can use the Rate options parameter to specify
how the block upsamples the input.
When you set the Rate options parameter to
Enforce single-rate processing, the input and output of the block have the same sample rate. In this mode, the block outputs a signal with a proportionally larger frame size than the input. The block upsamples each channel independently by repeating each row of the input matrix L times at the output. For upsampling by a factor of L, the output frame size is L times larger than the input frame size (Mo = Mi*L), but the input and output frame rates are equal.For an example that shows how the Repeat block operates in the single-rate processing mode, see Repeat Signal in Single-Rate Frame-Based Processing Mode.
When you set the Rate options parameter to
Allow multirate processing, the block treats an Mi-by-N matrix input as N independent channels. The block generates the output at the faster (upsampled) rate by using a proportionally shorter frame period at the output port than at the input port. For L repetitions of the input, the output frame period is L times shorter than the input frame period (Tfo = Tfi/L). In this mode, the output always has the same frame size as the input.For an example that shows how the Repeat block operates in the multirate frame-based processing mode, see Repeat Signal in Multirate Frame-Based Processing Mode.
When you set the Input processing parameter to
Elements as channels (sample based), the block treats
an M-by-N matrix input as
M*N independent channels, and upsamples
each channel over time. The block upsamples each channel over time such that the
output sample rate is L times higher than the input sample rate
(Tso =
Tsi/L).
In this mode, the output is always the same size as the input.
The Repeat block has tasking latency for a multirate multitasking operation:
In the multirate sample-based processing mode, the block repeats the initial condition for each channel for the first L output samples. The first element of the input channel appears as output sample L+1. The Initial conditions parameter can be an Mi-by-N matrix containing one value for each channel, or a scalar value that the block applies to all signal channels.
In the multirate frame-based processing mode, the block repeats the first row of the initial condition matrix for the first L output samples, the second row of the initial condition matrix for the next L output samples, and so on. The first row of the first input matrix appears in the output as sample MiL+1. The Initial conditions parameter can be an Mi-by-N matrix, or a scalar value that the block repeats across all elements of the Mi-by-N matrix.
Note
For more information on latency and Simulink® tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Time-Based Scheduling and Code Generation (Simulink Coder).
The Repeat block has zero-tasking latency for all
single-rate operations. The block is in a single-rate mode if you specify a
repetition count of 1 or if you set the Input
processing parameter to Columns as channels (frame
based) and the Rate options parameter to
Enforce single-rate processing.
The Repeat block also has zero-tasking latency for multirate operations if you run your model in Simulink single-tasking mode.
Zero-tasking latency means that the block repeats the first input (received at
t=0) for the first L
output samples, the second input for the next L output samples,
and so on.
Extended Capabilities
Generated code relies on the memcpy or
memset function (string.h) under certain
conditions.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.
This block has one default HDL architecture.
| ConstrainedOutputPipeline | Number of registers to place at
the outputs by moving existing delays within your design. Distributed
pipelining does not redistribute these registers. The default is
|
| InputPipeline | Number of input pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
| OutputPipeline | Number of output pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
| SynthesisAttributes |
Specifies the synthesis attributes for the blocks and block output signals in the model. The generated HDL code contains these attributes. For more information, see SynthesisAttributes (HDL Coder). |
The block supports these data types for HDL code generation:
| Input Port | Dimension | Fixed-Point | Floating-Point | Built-in Integers | Bus | Boolean | Complex Signal |
|---|---|---|---|---|---|---|---|
| in | Scalar Vector Matrix | Yes | Single Double | Yes | Yes | Yes | Yes |
When you use single
or double data types as inputs to the block, you can generate
synthesizable HDL code by using native floating-point technology. For more
information, see Generate Target-Independent HDL Code with Native Floating-Point (HDL Coder). (since R2026a)
| Block Parameter | Limitations |
|---|---|
| Input processing | Input processing set to
|
| Repetition count source | Repetition count source set to
|
The block participates in these HDL optimizations to optimize the speed, and area.
Speed Optimization
| Optimization | Description |
|---|---|
| Specify Distributed Pipelining Settings (HDL Coder) | Distributed pipelining, or register retiming, is a speed optimization that moves existing delays in a design to reduce the critical path while preserving functional behavior. |
| Clock-Rate Pipelining (HDL Coder) | Clock-rate pipelining is an optimization framework in HDL Coder that allows other speed and area optimizations to introduce latency at the clock rate. |
| Delay Balancing (HDL Coder) | Using delay balancing, HDL Coder detects introduced latency along one path and then inserts matching delays on the other paths in your generated model. |
| Critical Path Estimation (HDL Coder) | To quickly identify the most likely critical path in your design, use Critical Path Estimation. Critical path estimation speeds up the iterative process of finding the critical path. To know blocks that are characterized in critical path estimation, see Characterized Blocks (HDL Coder). |
When using the Repeat block to model rate transitions, see Usage of Rate Conversion Blocks (HDL Coder)
The Repeat block uses fewer hardware resources than the Upsample block. If your algorithm does not require zero-padding upsampling, use the Repeat block.
Version History
Introduced before R2006aWhen you use single or double data types as
inputs to the Repeat block, you can generate synthesizable HDL code by using native
floating-point technology. To generate the HDL code with native floating-point, in
the HDL Code Generation > Floating-Point pane of the
Configuration Parameters dialog box, select the Use
floating-point parameter. For more information on native
floating-point, see Generate Target-Independent HDL Code with Native Floating-Point (HDL Coder).
You can also use various HDL optimizations, such as distributed pipelining, hierarchy flattening, or balancing, for the block to generate optimized HDL code for your DSP application.
You can now specify the repetition count through an input port when the Repeat block operates in the single-rate frame-based processing mode. When you specify the repetition count through the input port, you can change the value during simulation.
Starting in R2022b, when you set Input processing to
Columns as channels (frame based) and Rate
options to Enforce single-rate processing,
the input can be a variable-size signal. That is, the frame size (number of rows)
and the number of channels (columns) of the signal can change during
simulation.
When the input is a variable-size signal, the output is also a variable-size signal.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)

