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

    %% Remove Noise Using Block LMS Adaptive Algorithm

%%
% *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).
 
 blms = dsp.BlockLMSFilter(10,5);
 blms.StepSize = 0.01;
 blms.WeightsOutputPort = false;
 filt = dsp.FIRFilter;
 filt.Numerator = fir1(10,[.5, .75]);
 x = randn(1000,1); % Noise
 d = filt(x) + sin(0:.05:49.95)'; % Noise + Signal
 [y, err] = blms(x, d);
 subplot(2,1,1);
 plot(d);
 title('Noise + Signal');
 subplot(2,1,2);
 plot(err);
 title('Signal');