简单的回波对消程序(LMS)
条件:不考虑近端干扰,不设双端检测器,自适应算法(LMS)%% 回波对消简单的仿真实例
% 仿真语音对消
% 不考虑近端干扰
% 不设双端检测器
% 采用LMS算法
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all
Fs = 1000;
t = 0:1/Fs:2;
fc = 10;
x = sin(2*pi*fc*t); % 以sin信号作为远端信号
h = ; % 回波干扰冲激响应
y = filter(h,1,x); % 回波
y = awgn(y,30,'measured'); % 加噪声
M = 21;
mu = 0.04;
len = length(x); % 信号的长度
output = zeros(1, len); % LMS滤波器的输出
wn = zeros(M, len); % 初始化权向量wn
ref = zeros(M, 1);
for n = 1:len-1
if n < M
ref = .';
else
ref = y(n:-1:n - M + 1).';
end
output(n) = x(n) - wn(:, n)' * ref;
wn(:,n+1) = wn(:,n) + mu*ref*conj(output(n));
end
ref = y(len:-1:len-M+1).';
output(len) = x(len) - wn(:, len)' * ref;
plot(abs(output))转自:http://blog.sina.com.cn/s/blog_5def5a660100u2hn.html
页:
[1]