⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 batch_algorithm1.m

📁 在OFDM系统中
💻 M
字号:
 %Training based channel estimation/equalization
% batch algorithm, MMSE equalizer
%
% 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=1000;   % total number of data
M=500;    % 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)
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)/norm(vn))       % Check SNR of the received samples
x=x+vn;                           % received signal

%%%%%%%%%%%%% channel equalization
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

hb=zeros(N+1,1);  % estimated channel
for i=1:M-10     % need carefully adjust parameter 10 to have positive subscript
    hb=hb+X(:,i+10)*conj(s(i+10+N-P));  % channel estimation (use all data samples)
end
hb=hb/norm(hb);
%hb=hb(N+1:-1:1)/norm(hb);      % normalized channel estimation
%hb1=hb(P-Lh+1:P-Lh+1+Lh).'; hb1=hb1/norm(hb1);  % remove zero head and tail (because N>Lh)
%Channel_MSE=norm(hb1-h)  % estimation error MSE

Rx=zeros(N+1,N+1);  % before calculate correlations, initialize
for i=1:Lp
    Rx=Rx+X(:,i)*X(:,i)';   % calculate correlation matrix
end
Rx=Rx/Lp;  

f=inv(Rx)*hb;  % calculate the MMSE equalizer

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

% calculate SER
sb1=sb/(f'*hb);  % 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

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')

end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -