基本信息
源码名称:基于MMSE的LMS算法
源码大小:2.90KB
文件格式:.m
开发语言:MATLAB
更新时间:2021-04-26
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
基于MMSE的LMS算法,可直接运行

% Training based channel equalization  基于训练的信道均衡
% adpative MMSE equalizer via LMS algorithm  基于LMS算法的自适应MMSE均衡器
%
% Copyright: Xiaohua(Edward) Li, Assistant Professor
%            Department of Electrical and Computer Engineering
%            State University of New York at Binghamton
%            http://ucesp.ws.binghamton.edu/~xli
% June 2003
%
T=3000;    % total number of data  数据量为3000
M=2000;    % total number of training symbols  总的训练符号的数量
dB=25;     % SNR in dB value

%%%%%%%%% Simulate the Received noisy Signal  %%%%%%%%%%%
N=20; % smoothing length N 1
Lh=5;  % channel length = Lh 1
P=round((N Lh)/2);  % equalization delay    时延均衡

h=randn(1,Lh 1) sqrt(-1)*randn(1,Lh 1);   % channel (complex) 复杂信道 产生1*Lh 1的矩阵
h=h/norm(h);                     % normalize  归一化

s=round(rand(1,T))*2-1;  % QPSK or 4 QAM symbol sequence
s=s sqrt(-1)*(round(rand(1,T))*2-1);

% generate received noisy signal
x=filter(h,1,s);
vn=randn(1,T) sqrt(-1)*randn(1,T);   % AWGN noise (complex)
vn=vn/norm(vn)*10^(-dB/20)*norm(x);  % adjust noise power with SNR dB value
SNR=20*log10(norm(x)/vn);       % Check SNR of the received samples
x=x vn;                           % received signal

%%%%%%%%%%%%% adaptive MMSE equalizer estimation  自适应MMSE均衡器估计
Lp=T-N;   %% remove several first samples to avoid 0 or negative subscript
X=zeros(N 1,Lp);  % sample vectors (each column is a sample vector)
for i=1:Lp
    X(:,i)=x(i N:-1:i).';
end


e=zeros(1,M-10);  % used to save instant error  1990
f=zeros(N 1,1);   % initial condition
mu=0.001;        % parameter to adjust convergence and steady error
for i=1:M-10
    e(i)=s(i 10 N-P)-f'*X(:,i 10);   % instant error  误差函数  N=20
    f=f mu*conj(e(i))*X(:,i 10);           % update equalizer estimation  conj:求e(i)的复共轭
    i_e=[i/10000 abs(e(i))];             % output information  输出信息
end

sb=f'*X;   % estimate symbols (perform equalization)

% calculate SER
sb1=sb/norm(f);  % scale the output
sb1=sign(real(sb1)) sqrt(-1)*sign(imag(sb1));  % perform symbol detection
start=7;  % carefully find the corresponding begining point
sb2=sb1 s(start 1:start length(sb1));  % find error symbols
SER=length(find(sb2~=0))/length(sb2);   % calculate SER

figure(2)
if 1
    subplot(221), 
    plot(s,'o');   % show the pattern of transmitted symbols
    grid,title('Transmitted symbols');  xlabel('Real'),ylabel('Image')
    axis([-2 2 -2 2])
    
    subplot(222),
    plot(x,'o');  % show the pattern of received samples
    grid, title('Received samples');  xlabel('Real'), ylabel('Image')
    
    subplot(223),
    plot(sb,'o');   % show the pattern of the equalized symbols
    grid, title('Equalized symbols'), xlabel('Real'), ylabel('Image')

    subplot(224),
    plot(abs(e));   % show the convergence
    grid, title('Convergence'), xlabel('n'), ylabel('Error e(n)')
end