LMS(least mean square)自适应滤波算法matlab实现

以下是matlab帮助文档中lms示例程序,应用在一个系统辨识的例子上.整个滤波的过程就两行,用红色标识.

x  = randn(1,500);     % Input to the filter
b  = fir1(31,0.5);     % FIR system to be identified
n  = 0.1*randn(1,500); % Observation noise signal
d  = filter(b,1,x)+n;  % Desired signal
mu = 0.008;            % LMS step size.
ha = adaptfilt.lms(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[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([b.',ha.coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;

这实在看不出什么名堂,就学习目的而言,远不如自己写一个出来.整个滤波的过程用红色标识.

%% System Identification (SID)
% This demonstration illustrates the application of LMS adaptive filters to
% system identification (SID). 
%
% Author(s

你可能感兴趣的:(信号处理算法)