%% Reset an LMS 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).

 lms1 = dsp.LMSFilter(11, 'StepSize', 0.01);
 filt = dsp.FIRFilter; % System to be identified
 filt.Numerator = fir1(10, .25);
 x = randn(1000,1); % input signal
 d = filt(x) + 0.01*randn(1000,1); % desired signal
 [y,e,w] = lms1(x, d);

%
% Call LMS algorithm again without resetting filter states.

 [y1,e1,w1] = lms1(x,d);
 isequal(y,y1)

%
% Now reset the filter states to zero.

 reset(lms1)

%
% Call the LMS algorithm.

 [y2,e2,w2] = lms1(x,d);
 isequal(y,y2)

% Copyright 2012 The MathWorks, Inc.