Repeat - Resample input at higher rate by repeating values - Simulink (original) (raw)

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_M_i-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 theRate options parameter to Enforce single-rate processing.

Examples

Ports

Input

expand all

Specify the input signal as a real or a complex-valued scalar, vector, or a matrix.

When you set Input processing toColumns as channels (frame based) andRate 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 theMaximum 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

expand all

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 andRate options to:

When you input the repetition count through the input port L, the Rate options parameter is automatically set toEnforce 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:

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point
Complex Number Support: Yes

Parameters

expand all

Since R2023a

Specify the repetition count through one of these options:

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, setRepetition 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:

Dependency

To enable this parameter, setRepetition count source to Dialog parameter. (since R2023a)

When you setRepetition 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:

Dependency

To enable this parameter, setRepetition count source to Dialog parameter. (since R2023a)

When you setRepetition 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 Boolean | double fixed point integer single
Direct Feedthrough no
Multidimensional Signals no
Variable-Size Signals yes
Zero-Crossing Detection no

More About

expand all

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 Input processing parameter toElements 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 (T so =T si/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:

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 toEnforce 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

expand all

Generated code relies on the memcpy ormemset function (string.h) under certain conditions.

HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.

Best Practices

The Repeat block uses fewer hardware resources than the Upsample block. If your algorithm does not require zero-padding upsampling, use the Repeat block.

HDL Architecture

This block has one default HDL architecture.

HDL Block Properties

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 is0. For more details, see ConstrainedOutputPipeline (HDL Coder).
InputPipeline Number of input pipeline stages to insert in the generated code. Distributed pipelining and constrained output pipelining can move these registers. The default is0. For more details, see InputPipeline (HDL Coder).
OutputPipeline Number of output pipeline stages to insert in the generated code. Distributed pipelining and constrained output pipelining can move these registers. The default is0. For more details, see OutputPipeline (HDL Coder).

Restrictions

Input processing set to Columns as channels (frame based) is not supported.

Version History

Introduced before R2006a

expand all

You can now specify the repetition count through an input port when theRepeat 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 toColumns 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.