%% Reset a Sample Rate Converter
% Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).
% 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.

src = dsp.SampleRateConverter;

[L,M] = getRateChangeFactors(src);

%
% Create a two-channel random signal. Specify a number of samples equal to the decimation factor. Call the object twice on the signal.

x = randn(M,2);

y1 = src(x);
y2 = 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 call the converter again. Verify that the output is unchanged.

reset(src)

y3 = src(x);

yes = all(y3==y1)

% Copyright 2012 The MathWorks, Inc.