www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/UsingOutputToleranceWithFarrowSampleRateConverterExample.m

    %% Using Output Tolerance To Reduce Input Size Restriction
% Create a Farrow rate converter with 0% tolerance. The output rate  
% matches |OutputSampleRate| exactly. However, the input size must be a 
% multiple of the decimation factor, M. In this case M is 320. 

% Copyright 2015 The MathWorks, Inc.

frc = dsp.FarrowRateConverter('InputSampleRate', 96e3,'OutputSampleRate',44.1e3);
FsOut = getActualOutputRate(frc)
[L,M] = getRateChangeFactors(frc) 
%%
% Allow a 1% tolerance on the output rate and observe the difference in 
% decimation factor. M is now only 13. The lower decimation factor allows 
% more flexibility in input size. The output rate is within the range 
% |OutputSampleRate| $\pm$ 1%.
frc.OutputRateTolerance = 0.01; 
FsOut = getActualOutputRate(frc)
[Le,Me] = getRateChangeFactors(frc)