Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Reduce sampling rate by averaging consecutive samples

Sequence Operations

The Derepeat block resamples the discrete input
at a rate 1/N times the input sample rate by averaging
N consecutive samples. This is one possible inverse of the DSP System
Toolbox™ Repeat block. The positive integer N is the **Derepeat
factor** parameter in the Derepeat dialog.

The **Initial condition** parameter prescribes
elements of the output when it is still too early for the input data
to show up in the output. If the dimensions of the **Initial
condition** parameter match the output dimensions, then the
parameter represents the initial output value. If **Initial
condition** is a scalar, then it represents the initial value
of each element in the output. The block does not support empty matrices
for initial conditions.

The input can have any shape or frame status. The block accepts
the data types `single`

and `double`

.
The output signal inherits its data type from the input signal.

This block works within a triggered subsystem, as long as you use it in the single-rate mode.

The block derepeats each frame, treating distinct channels independently.
Each element of the output is the average of N consecutive elements
along a *column* of the input matrix. The **Derepeat
factor** must be less than the frame size.

When you set the **Rate options** parameter
to `Enforce single-rate processing`

, the
input and output of the block have the same sample rate. The block
reduces the sampling rate by using a proportionally smaller frame *size* than
the input. **Derepeat factor** should be an integer
factor of the number of rows in the input vector or matrix. For derepetition
by a factor of N, the output frame size is 1/N times
the input frame size, but the input and output frame rates are equal.
When you use this option, the **Initial condition** parameter
does not apply and the block incurs no delay, because the input data
immediately shows up in the output.

For example, if a single-channel input with 64 elements is derepeated by a factor of 4, then the output contains 16 elements. The input and output frame periods are equal.

When you set the **Rate options** parameter
to `Allow multirate processing`

, the input
and output of the Derepeat block are the same size, but the sample
rate of the output is *N* times slower than that
of the input. When the block is in multirate processing mode, you
must also specify a value for the **Input processing** parameter:

When you set the

**Input processing**parameter to`Elements as channels (sample based)`

, then the block assumes that the input is a vector or matrix whose elements represent samples from independent channels. The block averages samples from each channel independently over time. The output period is N times the input period, and the input and output sizes are identical. The output is delayed by one output period, and the first output value is the**Initial condition**value. If you set**Rate options**to`Enforce single-rate processing`

, the block will generate an error message.When you set the

**Input processing**parameter to`Columns as channels (frame based)`

, The block reduces the sampling rate by using a proportionally longer frame*period*at the output port than at the input port. For derepetition by a factor of N, the output frame period is N times the input frame period, but the input and output frame sizes are equal. The output is delayed by one output frame, and the first output frame is determined only by the**Initial condition**value. The block derepeats each frame, treating distinct channels independently. Each element of the output is the average of N consecutive elements along a*column*of the input matrix. The**Derepeat factor**must be less than the frame size.For example, if a single-channel input with a frame period of 1 second is derepeated by a factor of 4, then the output has a frame period of 4 seconds. The input and output frame sizes are equal.

**Derepeat factor, N**The number of consecutive input samples to average in order to produce each output sample.

**Input processing**Specify how the block processes the input signal. You can set this parameter to one of the following options:

`Columns as channels (frame based)`

— When you select this option, the block treats each column of the input as a separate channel.`Elements as channels (sample based)`

— When you select this option, the block treats each element of the input as a separate channel.

**Rate options**Select the rate processing option for the block.

`Enforce single-rate processing`

— When you select this option, the input and output signals have the same port sample time. The block implements the rate change by making a size change at the output when compared to the input. The output width equals the product of the number of symbols and the**Samples per symbol**parameter value.`Allow multirate processing`

— When you select this option, the input and output signals have different port sample times. The output sample time equals the symbol period divided by the**Samples per symbol**parameter value.### Note

The option

`Inherit from input (this choice will be removed - see release notes)`

will be removed in a future release. See Frame-Based Processing in the*Communications System Toolbox™ Release Notes*for more information.

**Initial condition**The value with which to initialize the block.

Repeat (DSP System Toolbox documentation), Downsample (DSP System Toolbox documentation)

Was this topic helpful?