Main Content

getRateChangeFactors

Get overall interpolation and decimation factors

Description

example

[L,M] = getRateChangeFactors(rateConverter) returns the overall interpolation factor, L, and the overall decimation factor, M, corresponding to the rateConverter. The rate converter object can be a dsp.FarrowRateConverter System object™ or a dsp.SampleRateConverter System object. The rate change factors computed take into account the OutputRateTolerance property.

In the case of dsp.SampleRateConverter, the overall decimation factor affects the allowable frame size of the input to the object. The row length of the input vector or matrix to the dsp.SampleRateConverter object must be an integer multiple of M.

This function supports C and C++ code generation.

Examples

collapse all

Create a default dsp.FarrowRateConverter object that converts a signal from 44.1 kHz to 48 kHz.

frc = dsp.FarrowRateConverter
frc = 
  dsp.FarrowRateConverter with properties:

   Main
        InputSampleRate: 44100
       OutputSampleRate: 48000
    OutputRateTolerance: 0
          Specification: 'Polynomial order'
        PolynomialOrder: 3

  Use get to show all properties

Return the overall interpolation (L) and decimation (M) factors of the filter object.

[L,M] = getRateChangeFactors(frc)
L = 160
M = 147

Create src, a multistage sample rate converter with default properties. src combines three filter stages to convert from 192 kHz to 44.1 kHz. Determine its overall interpolation and decimation factors.

src = dsp.SampleRateConverter;
[L,M] = getRateChangeFactors(src)
L = 147
M = 640

Input Arguments

collapse all

Polynomial sample rate conversion filter, specified as a dsp.FarrowRateConverter or a dsp.SampleRateConverter System object.

Output Arguments

collapse all

Overall interpolation factor, returned as a scalar.

Data Types: double

Overall decimation factor, returned as a scalar. In the case of dsp.SampleRateConverter, the overall decimation factor affects the allowable frame size of the input to the object. The row length of the input vector or matrix to the dsp.SampleRateConverter object must be an integer multiple of M.

Data Types: double

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2014b