📄 training based channel equalization.m
字号:
T=1000; % total number of data
dB=25; % SNR in dB value
%%%%%%%%% Simulate the Received noisy Signal %%%%%%%%%%%
N=5; % smoothing length N+1
P=5; % shifting Lh <= P <= N
Lh=5; % channel length = Lh+1
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 identification
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:Lp-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(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
if 1
subplot(222),
plot(1:Lh+1,real(h),'bo-',1:Lh+1,real(hb1),'rx-'), grid
title('Channel #1. o:real, x: estimated')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -