Multistage sample-rate conversion
DSP System Toolbox / Signal Operations
The Sample-Rate Converter block implements a multistage FIR sample-rate converter. The multistage FIR converter converts the rate of each channel of the input signal from the input sample rate to the output sample rate. Multistage implementations minimize the amount of computation required for the sample-rate conversions by first reducing the sample rate of the input signal. Next, the block determines the optimal number of decimators and interpolators based on the parameters you specify in the block dialog box. The block then accordingly designs filters in the individual stages.
This block supports SIMD code generation. For details, see Code Generation.
Port_1 — Input signal
scalar | vector | matrix
Specify the input signal as a real or a complex-valued scalar, vector, or a matrix.
The input frame size must be a multiple of the decimation factor of the rate converter. The decimation factor depends on the parameter setting of the converter. To determine the decimation factor, in the block dialog box, click View Info .
The block treats each column of a two-dimensional input signal as a separate channel. If the input is a two-dimensional signal, the first dimension represents the channel length (or frame size), and the second dimension represents the number of channels. If the input is a one-dimensional signal, then the block interprets the signal as having a single channel.
Complex Number Support: Yes
Port_1 — Resampled signal
scalar | vector | matrix
The Sample-Rate Converter block outputs a signal that has the same data type and complexity as the input signal. The size of the output signal depends on the overall interpolation factor and the decimation factor of the Sample-Rate Converter. You can determine this information by clicking the View Info button in the block dialog box.
Complex Number Support: Yes
Sample rate of input signal (Hz) — Sample rate of input signal in Hz
48e3 (default) | positive scalar
Specify the sample rate of the input signal as a positive scalar in Hz. The input sample rate must be greater than the bandwidth of interest.
Sample rate of output signal (Hz) — Sample rate of output signal in Hz
96e3 (default) | positive scalar
Specify the sample rate of the output signal as a positive scalar in Hz. The output sample rate must be greater than the bandwidth of interest.
Tolerance for output sample rate — Maximum tolerance for output sample rate
0 (default) | positive scalar in the range
Specify the maximum tolerance for the output sample rate as a positive
scalar in the range [
The actual output sample rate varies but is within the specified range. For example, if you set the Tolerance for output sample rate to 0.01, then the actual output sample rate is in the range given by sample rate of output signal ± 1%. This flexibility allows for a simpler filter design.
Two-sided bandwidth of interest (Hz) — Two-sided bandwidth of interest in Hz
40e3 (default) | positive scalar
Specify the two-sided bandwidth of interest (after the rate of conversion) as a positive scalar in Hz.
Stopband attenuation (dB) — Minimum attenuation for aliased components in dB
80 (default) | positive scalar
Specify the minimum amount of attenuation for aliased components in the stopband as a positive scalar in dB. This parameter is the minimum amount by which the block attenuates any aliasing involved in the process.
View Filter Response — View Filter Response
Opens the Filter Visualization Tool FVTool and displays the magnitude/phase response of the Sample-Rate Converter. The response is based on the block parameters. FVTool updates when you change the parameters.
To update the magnitude response while FVTool is running, modify the parameters in the dialog box and click Apply.
View Info — Display information about filter
Click on the View Info button to display the filter information of the Sample-Rate Converter block:
Overall Interpolation Factor
Overall Decimation Factor
Number of Filters
Multiplication per Input Sample
Number of Coefficients
The button brings the functionality of the
function into the Simulink® environment.
Simulate using — Type of simulation to run
Code generation (default) |
Type of simulation to run. You can set this parameter to:
Simulate model using generated C code. The first time you run a simulation, Simulink generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than
Simulate model using the MATLAB® interpreter. This option shortens startup time but has slower simulation speed than
The general multistage sample rate converter performs a multistage decimation, a single-stage sample rate conversion, and a multistage interpolation. Actual designs include at most two of these steps.
The procedure automatically determines the optimal number of decimation or interpolation stages. In special cases, the algorithm can perform a decimation or interpolation in a single stage.
The algorithm always attempts to start by reducing the sample rate. This decreases the amount of computation required. The decimation step ensures that the intermediate sample rate does not go below the bandwidth of interest and that the block does not filter out any information.
Each individual stage uses halfband or Nyquist filters to minimize the number of nonzero coefficients.
The algorithm allows transition-band aliasing because it decreases the implementation cost. It keeps the signal within the bandwidth of interest alias free up to the value specified by the
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
The Sample-Rate Converter block supports SIMD code generation using Intel AVX2 technology under these conditions:
For upsampling, the ratio of output sample rate to input sample rate must be an integer.
For downsampling, the ratio of input sample rate to output sample rate must be an integer.
Input signal has a data type of
The SIMD technology significantly improves the performance of the generated code.
Introduced in R2015b