📄 lms5.m
字号:
%LMS5 Problem 2.1
%
% 'ifile.mat' - input file containing:
% K - iterations
% H - FIR channel
% Neq - equalizer order
% sigman - standard deviation of noise at channel output
% mu - convergence factor
%
% 'ofile.mat' - output file containing:
% ind - sample indexes
% Weq - coefficient vector of equalizer
clear all % clear memory
load ifile; % read input variables
LH=length(H); % channel length
NH=LH-1; % channel order
Leq=Neq+1; % equalizer length
ND=round((Neq+NH)/2); % delayer order
LD=ND+1; % delayer length (>LH by hipothesis)
D=zeros(LD,1); % initial delayer memory
X=zeros(Leq,1); % initial memory
Weq=zeros(Leq,1); % initial coefficient vector
t=sign(randn(K,1)); % training signal
n=randn(K,1)*sigman; % noise at channel output
for k=1:K, % iterations
D=[t(k)
D(1:ND)]; % new delay vector
d=D(LD); % desired signal sample
x=H'*D(1:LH)+n(k); % input sample
X=[x
X(1:Neq)]; % new input vector
y=Weq'*X; % output sample
e=d-y; % error sample
Weq=Weq+2*mu*e*X; % new coefficient vector
end
ind=0:Neq; % sample indexes
save ofile ind Weq; % write output variables
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -