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

    %% Reset a Sample Rate Converter
% Create a multistage sample rate converter with default properties,
% corresponding to the combined three filter stages used to convert from
% 192 kHz to 44.1 kHz. Determine its overall decimation and interpolation
% factors.

% Copyright 2015 The MathWorks, Inc.


%%

src = dsp.SampleRateConverter;

[L,M] = getRateChangeFactors(src);

%%
% Create a two-channel random signal. Specify a number of samples equal to
% the decimation factor. Apply the |step| method twice on the signal.

x = randn(M,2);

y1 = step(src,x);
y2 = step(src,x);

no = all(y2==y1)

%%
% The output is different because the internal states of |src| have
% changed. Use |reset| to reset the converter and apply |step| again.
% Verify that the output is unchanged.

reset(src)

y3 = step(src,x);

yes = all(y3==y1)