Main Content

Sample-Rate Converter

Multistage sample-rate conversion

  • Library:
  • DSP System Toolbox / Signal Operations

  • Sample-Rate Converter block

Description

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.

Ports

Input

expand all

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.

Data Types: single | double
Complex Number Support: Yes

Output

expand all

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.

Data Types: single | double
Complex Number Support: Yes

Parameters

expand all

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.

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.

Specify the maximum tolerance for the output sample rate as a positive scalar in the range [0,0.5]. The default is 0.

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.

Specify the two-sided bandwidth of interest (after the rate of conversion) as a positive scalar in Hz.

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.

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.

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

  • Filters

The button brings the functionality of the info function into the Simulink® environment.

Type of simulation to run. You can set this parameter to:

  • Code generation (default)

    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 Interpreted execution.

  • Interpreted execution

    Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than Code generation.

Block Characteristics

Data Types

double | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Algorithms

  • 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 StopbandAttenuation property.

Extended Capabilities

Version History

Introduced in R2015b