%% Reset an FIR Filter
% Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

fir = dsp.FIRFilter;
fir.Numerator = fir1(20,0.25);
n = 0:100;
x = cos(0.2*pi*n)+sin(0.8*pi*n);
y = fir(x);

%
% Filter states are nonzero. Invoke step method again without resetting states

y1 = fir(x);
isequal(y,y1)

%
% Now reset filter states to 0

reset(fir)

%
% Invoke step method

y2 = fir(x);
isequal(y,y2)

% Copyright 2012 The MathWorks, Inc.