📄 zfl0.m
字号:
function ZFL0(b)
%Zero_forcing linear Equalizer co channel, noise thay doi
% b:input
% b=sign(rand(1,5)-.5) %ma hoa BPSK
% h:channel
% d:output
%------------------
eq_tap = 1000;
pulse=zeros(1, eq_tap); pulse(1)=1;
% -----channel-----
h = pulse; %khong co ISI
h(1:4) = rand(1,4); %co ISI
h = h/norm(h);
subplot(7,1,1); plot(abs(fft(h))); grid;
title('channel impulse respond');
% --ZFL equalizer--
%fft(h) .* fft(eq) = fft(pulse)
eq = ifft(fft(pulse) ./ fft(h));
ho = conv(b, h); % channel output
n = .2*randn(1, length(ho)); % noise
y = ho+n; % input Equalizer
d = conv(y, eq); % equalizer output
subplot(7,1,7); stem(d,'b.'); title('received signal');
grid;
d = sign(d); %ma hoa BPSK
%----kiem tra so bit error----
l=length(b);
e1 = abs(b - d(1:l))/2 ; %error
BE1 = sum(e1)
e2 = abs(b - d(eq_tap +1 :eq_tap +l))/2 ; %error
BE2 = sum(e2)
BE = min(BE1,BE2)
%-------------------------------
if BE1 <= BE2
do = d(1:l);
subplot(7,1,6); stem(e1,'b.'); title('error')
else do = d(eq_tap +1 :eq_tap +l);
subplot(7,1,6); stem(e2,'b.'); title('error')
end
subplot(7,1,2); stem(h(1:4),'filled'); title('channel')
grid;
subplot(7,1,3); stem(eq,'b.'); title('equalizer')
grid;
subplot(7,1,4); stem(b,'b.'); title('input')
grid;
subplot(7,1,5); stem(do,'b.'); title('ZFL Equalizer output')
grid;
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -