www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/SystemIdentificationWithLMSFilterExample.m
%% System Identification Using LMS Filter 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); subplot(2,1,1); plot(1:1000, [d,y,e]); title('System Identification of an FIR filter'); legend('Desired', 'Output', 'Error'); xlabel('time index'); ylabel('signal value'); subplot(2,1,2); stem([filt.Numerator.',w]); legend('Actual','Estimated'); xlabel('coefficient #'); ylabel('coefficient value');