?? zfl.m
字號(hào):
function ZFL(b,h,n)
%Zero_forcing linear Equalizer co nhieu kenh truyen
% b:input -nhap gia tri ngoai
% b=sign(rand(1,5)-.5) %ma hoa BPSK
% h:channel -nhap gia tri ngoai
% n:noise -nhap gia tri ngoai
% d:output
% eq_tap:bac cua bo can bang
%------------------
subplot(7,1,1); plot(abs(fft(h)));
title('channel impulse respond');
eq_tap = length(h);
pulse=zeros(1, eq_tap); pulse(1)=1;
% --ZFL equalizer--
%fft(h) .* fft(eq) = fft(pulse)
eq = ifft(fft(pulse) ./ fft(h));
ho = conv(b, h); % channel output
No = .2;
n = No * n;
y = ho+n; % input Equalizer
d = conv(y, eq); % equalizer output
subplot(7,1,7); stem(d); title('d chua ma hoa')
grid;
d = sign(d);
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);
BER = BE / l
if BE1 <= BE2
do = d(1:l);
subplot(7,1,6); stem(e1,'x'); title('error')
else
do = d(eq_tap +1 :eq_tap +l);
subplot(7,1,6); stem(e2,'x'); title('error')
end
subplot(7,1,2); stem(h(1:5),'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 voi N_0=0.2')
grid;
return
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -