Derepeat
Reduce sampling rate by averaging consecutive samples
Libraries:
Communications Toolbox /
Sequence Operations
Description
The Derepeat block resamples the discrete input at a rate
1/N times the input sample rate by averaging N
consecutive samples. N represents the Derepeat factor,
N
parameter.
Examples
Derepeat Signal in Single-Rate, Frame-Based Processing Mode
In this example, the Derepeat block decreases the sample rate by averaging the consecutive samples.
Open the model. The input to the Derepeat block is a single-channel signal with a frame size of 64. In the block dialog box, set the Derepeat factor, M to 4
, Input processing to Columns as channels (frame based)
, and Rate options to Allow single-rate processing
.
Run the model. With a derepeat factor of 4, the output of the block has a frame size of 16. As the block operates in the single-rate processing mode, the input and output signals of the Derepeat block have the same frame rate.
Derepeat Signal in Multirate, Frame-Based Processing Mode
In this example, the Derepeat block decreases the sample rate by averaging the consecutive samples.
Open the model. The input to the Derepeat block is a single-channel signal with a frame size of 64. In the block dialog box, set the Derepeat factor, M to 4
, Input processing to Columns as channels (frame based)
, and Rate options to Allow multirate processing
.
Run the model. With a derepeat factor of 4, the output of the block has a frame period of 4 seconds. As the block operates in the multirate processing mode, the input and output signals of the Derepeat block have the same frame size.
open_system('ex_derepeat_multirate.slx'); sim('ex_derepeat_multirate.slx');
Ports
Input
In — Input signal
scalar | vector | matrix
Input signal, specified as a scalar, vector, or matrix.
Data Types: double
Complex Number Support: Yes
Output
Out — Output signal
scalar | vector | matrix
Output signal, returned as a scalar or column vector.
Data Types: double
Complex Number Support: Yes
For more information on the processing rates, see Single-Rate Processing, and Multirate Processing.
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Derepeat factor, N — Derepeat factor
5 (default) | integer
Derepeat factor, specified as an integer. The derepeat factor is the number of consecutive input samples to average to produce each output sample.
Input processing — Input processing control
Columns as channels (frame based)
(default) | Elements as channels (sample based)
Input processing control, specified as one of these options:
Columns as channels (frame based)
— The block treats each column of the input as a separate channel.Elements as channels (sample based)
— The block treats each element of the input as a separate channel.
Rate options — Block processing rate
Allow multirate
processing
(default) | Enforce single-rate processing
Block processing rate, specified as one of these options:
Allow multirate processing
— The block downsamples the signal such that the output sample rate isDerepeat factor, N
times slower than the input sample rate. For more information, see Multirate Processing.Enforce single-rate processing
— The block maintains the input sample rate by decreasing the output frame size by a factor equal to theDerepeat factor, N
parameter value. Also, in single-rate processing mode you can use this block in a triggered subsystem. For more information, see Single-Rate Processing
Initial condition — Initial condition
0 (default) | scalar | vector | matrix
Initial condition, specified as a scalar, vector, or matrix. This parameter specifies values that are output when it is 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.
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
More About
Single-Rate Processing
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. N must
be less than the frame size. N represents the Derepeat
factor, N
parameter.
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. To process
all input values, N must 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, for a single-channel input with 64 elements that is derepeated by a factor of 4, the block outputs 16 elements. The input and output frame periods are equal.
Also, in single-rate processing mode you can use this block in a triggered subsystem.
Multirate Processing
When you set the Rate options
parameter to Allow
multirate processing
, the input and output of the block are the
same size, but the sample rate of the output is N times slower
than the input. N represents the Derepeat factor,
N
parameter.
When you set the
Input processing
parameter toElements as channels (sample based)
, 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 theInitial condition
value. If you setRate options
toEnforce single-rate processing
, the block generates an error message.When you set the
Input processing
parameter toColumns 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 theInitial 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, for a single-channel input with a frame period of 1 second that is derepeated by a factor of 4, the output has a frame period of 4 seconds. The input and output frame sizes are equal.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)