| Signal Processing Blockset™ | ![]() |
Signal Operations
dspsigops
The Repeat block upsamples each channel of the Mi-by-N input to a rate L times higher than the input sample rate by repeating each consecutive input sample L times at the output. You specify the integer L in the Repetition count parameter.
This block supports triggered subsystems if, for Frame-based mode, you select Maintain input frame rate.
When the input is sample based, the block treats each of the M*N matrix elements as an independent channel, and upsamples each channel over time. The Frame-based mode parameter must be set to Maintain input frame size. The output sample rate is L times higher than the input sample rate (Tso = Tsi/L), and the input and output sizes are identical.
When the input is frame based, the block treats each of the N input columns as a frame containing Mi sequential time samples from an independent channel. The block upsamples each channel independently by repeating each row of the input matrix L times at the output. The Frame-based mode parameter determines how the block adjusts the rate at the output to accommodate the repeated rows. There are two available options:
Maintain input frame size
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), but the input and output frame sizes are equal.
The model below shows a single-channel input with a frame period of 1 second being upsampled through 4-times repetition to a frame period of 0.25 second. The input and output frame sizes are identical.

Maintain input frame rate
The block generates the output at the faster (upsampled) rate by using a proportionally larger frame size than the input. For L repetitions of the input, 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.
The model below shows a single-channel input of frame size 16 being upsampled through 4-times repetition to a frame size of 64. The input and output frame rates are identical.

The Repeat block has zero-tasking latency for all single-rate operations. The block is single-rate for the particular combinations of sampling mode and parameter settings shown in the table below.
| Sampling Mode | Parameter Settings |
|---|---|
Sample based | Repetition count parameter, L, is 1. |
Frame based | Repetition count parameter, L, is 1, or Frame-based mode parameter is Maintain input frame rate. |
The block also has zero latency for all multirate operations in the 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. The Initial condition parameter value is not used.
The Repeat block has tasking latency only for multirate operation in the Simulink multitasking mode:
In sample-based mode, the initial condition for each channel is repeated for the first L output samples. The channel's first input appears as output sample L+1. The Initial condition value can be an Mi-by-N matrix containing one value for each channel, or a scalar to be applied to all signal channels.
In frame-based mode, the first row of the initial condition matrix is repeated for the first L output samples, the second row of the initial condition matrix is repeated 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 condition value can be an Mi-by-N matrix, or a scalar to be repeated across all elements of the Mi-by-N matrix. See the example below for an illustration of this case.
Note For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Models with Multiple Sample Rates in the Real-Time Workshop® User's Guide. |
Construct the frame-based model shown below.

Adjust the block parameters as follows.
Configure the Signal From Workspace block to generate a two-channel signal with frame size of 4 and sample period of 0.25. This represents an output frame period of 1 (0.25*4). The first channel should contain the positive ramp signal 1, 2, ..., 100, and the second channel should contain the negative ramp signal -1, -2, ..., -100.
Signal = [(1:100)' (-1:-1:-100)']
Sample time = 0.25
Samples per frame = 4
Configure the Repeat block to upsample the two-channel input by increasing the output frame rate by a factor of 2 relative to the input frame rate. Set an initial condition matrix of

Repetition count = 2
Initial condition = [11 -11;12 -12;13 -13;14 -14]
Frame-based mode = Maintain input frame size
Configure the Probe blocks by clearing the Probe width and Probe complex signal check boxes (if desired).
This model is multirate because there are at least two distinct sample rates, as shown by the two Probe blocks. To run this model in the Simulink multitasking mode, in the Solver pane of the Configuration Parameters dialog box, set the Type list to Fixed-step and set the Solver list to discrete (no continuous states). For the Tasking mode for periodic sample times parameter, select MultiTasking. Also set the Stop time to 30.
Run the model and look at the output, yout. The first few samples of each channel are shown below.
yout =
11 -11
11 -11
12 -12
12 -12
13 -13
13 -13
14 -14
14 -14
1 -1
1 -1
2 -2
2 -2
3 -3
3 -3
4 -4
4 -4
5 -5
5 -5
Since we ran this frame-based multirate model in multitasking mode, the block repeats each row of the initial condition matrix for L output samples, where L is the Repetition count of 2. The first row of the first input matrix appears in the output as sample 9 ,that is, sample MiL+1, where Mi is the input frame size.

The integer number of times, L, that the input value is repeated at the output. This is the factor by which the output frame size or sample rate is increased.
The value with which the block is initialized for cases of nonzero latency; a scalar or matrix.
For frame-based operation, the method by which to implement the repetition (upsampling): Maintain input frame size that is, increase the frame rate, or Maintain input frame rate, that is, increase the frame size. The Frame-based mode parameter must be set to Maintain input frame size for sample-base inputs.
| Port | Supported Data Types |
|---|---|
Input |
|
Output |
|
| FIR Interpolation | Signal Processing Blockset |
| Upsample | Signal Processing Blockset |
![]() | Remez FIR Filter Design | RLS Adaptive Filter | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |