📄 equalizer.m
字号:
clc;
clear;
a=[-3 -1 1 3]; % 4-PAM alphabet
Ak=a(randint(1000,1,4)+1); % 4-PAM sequence
figure(1);
plot(a,[0 0 0 0],'o');
title('4-PAM constellation');
grid;
H=fir1(8,0.6); % Channel model, FIR-filter
figure(2);
stem(H); % Impulse response of the channel
title('Impulse response of the channel')
figure(3);
freqz(H,1,256); % Frequency response of the channel
title('Frequency response of the channel')
Rk=filter(H,1,Ak); % Received signal
figure(4);
plot(Rk,zeros(size(Rk)),'o') ; % Constellation
title(' Constellation of the received signal');
grid;
% Initialization
FII=zeros([31,31]); % Autocorrelation Matrix
alfa=0;
% How to define FII and alfa
% The channel causes a delay. It can be seen from the maximum point of the impulse response.
% In this case, the delay is 5 (see channel impulse response).
for i=5:900,
rk=flipud(Rk(i:i+30).'); % received signal vector
FII=FII+rk*rk.'; % Autocorrelation matrix
alfa=alfa+Ak(i-4+15)*rk;
end
FII=FII/896;
alfa=alfa/896;
c=inv(FII)*alfa; % Equalizer coefficients
figure(5);
freqz(c,1,256); % Frequency response of equalizer
title('Frequency response of the equalizer')
H=fir1(8,0.8); % new channel
Rk=filter(H,1,Ak); % received signal
% close all; % Close all figures
beta=0.01; % step-size of the algorithm
c=zeros(size(1:31)).'; % equalizer coefficients, initializations
for i=5:900,
rk=flipud(Rk(i:i+30).'); % Received signal vector
Ek(i-4)=Ak(i-4+15)-c.'*rk; % Error signal, we use the symbol sequence known in
% advance
c=c+beta*Ek(i-4)*rk;
end
figure(6);
plot(abs(Ek)) % Covergence behaviour of the LMS-algorithm. Should be zero or
% near zero (in the case of channel noise) after the convergence
title('Covergence behaviour');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y=filter(c,1,Rk);
figure(7);
plot(y,zeros(size(Rk)),'o');grid; % Constellation
title('Constellation of the received signal');
figure(8);
freqz(H,1,256); % Frequency response of the channel
title('Frequency response of the channel');
figure(9);
freqz(c,1,256); % Frequency response of equalizer
title('Frequency response of the equalizer');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -