LMS(least mean square)自适应滤波算法matlab实现
来源:互联网 发布:macbook如何下载软件 编辑:程序博客网 时间:2024/05/21 22:57
以下是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): X. Gumdy
% Copyright 2008 The Funtech, Inc.
%% 信号产生
clear all;
N = 1000 ;
x = 10 * randn(N,1); % 输入信号
b = fir1(31,0.5); % 待辨识系d
n = randn(N,1);
d = filter(b,1,x)+n; % 待辨识系统的加噪声输出
%% LMS 算法手工实现
sysorder = 32;
maxmu = 1 / (x'*x / N * sysorder);% 通过估计tr(R)来计算mu的最大值
mu = maxmu / 10;
w = zeros ( sysorder , 1 ) ;
for n = sysorder : N
u = x(n-sysorder+1:n) ;
y(n)= w' * u;
e(n) = d(n) - y(n) ;
w = w + mu * u * e(n) ;
end
y = y';
e = e';
%% 画图
figure(1);
subplot(2,1,1); plot((1:N)',[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', w]);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;
自适应滤波也许算得上信号处理理论中比较有意思的部分了.
- LMS(least mean square)自适应滤波算法matlab实现
- 什么是LMS算法(Least mean square)
- Adaline:Least-Mean-Square (LMS)
- LMS算法MatLab实现
- 自适应滤波:LMS/NLMS
- 20170221机器学习代码1. LMS(Least mean squares)最小均方值. MATLAB
- 自适应滤波(LMS,RLS)
- 自适应滤波的matlab实现
- 维纳滤波LMS matlab
- 一分钟了解“Matlab实现max-mean滤波”
- 自适应中值滤波及MATLAB实现
- 自适应中值滤波及matlab实现
- MATLAB实现中值滤波算法
- 寻求LMS算法及matlab或者VC实现
- LMS权值更新法则(Least mean squares,最小均方)
- 自适应滤波器中LMS算法的应用
- 中值滤波原理及MATLAB算法实现
- 自适应滤波器及LMS自适应算法的理解
- 日历控件的代码及使用方法
- 拆分显示自己的view
- xml学习一
- 付钱让员工辞职,Zappos 的成功秘诀
- 简单与复杂
- LMS(least mean square)自适应滤波算法matlab实现
- JDK
- 用内存管理器的钩子函数跟踪内存泄漏
- 2008.5.25,重新安装DELL
- portknocking(端口试探) demo
- HTML中的转义字符
- 委托
- 如何制作土豆泥
- ASP.NET Post页面及验证视图状态MAC失败问题正确的解决办法