Main Content


Implementation cost of the sample rate converter



c = cost(src) returns a structure, c, whose fields contain information about the computational cost of implementing a multistage sample rate converter, src.


collapse all

Create src, a multistage sample rate converter with default values. src combines three filter stages to convert from 192 kHz to 44.1 kHz. Determine its computational cost: the number of coefficients, the number of states, the number of multiplications per unit sample, and the number of additions per unit sample.

src = dsp.SampleRateConverter;
cst = cost(src)
cst = struct with fields:
                  NumCoefficients: 8631
                        NumStates: 138
    MultiplicationsPerInputSample: 27.6672
          AdditionsPerInputSample: 26.6875

Repeat the computation allowing a tolerance of 10% in the output sample rate.

src.OutputRateTolerance = 0.1;
ctl = cost(src)
ctl = struct with fields:
                  NumCoefficients: 44
                        NumStates: 80
    MultiplicationsPerInputSample: 14.2500
          AdditionsPerInputSample: 13.5000

Input Arguments

collapse all

Multistage sample rate converter, specified as a dsp.SampleRateConverter System object.

Output Arguments

collapse all

Output structure with information about the computational cost of src:

Estimated Value



Number of filter coefficients (excluding coefficients with values 0, 1 or −1)


Number of filter states


Number of multiplication operations performed for each input sample


Number of addition operations performed for each input sample

Version History

Introduced in R2014b