📄 cczffinal.m
字号:
%-------------------------------------------------------%%Name: Zero Forcing equalizer%Function: simulate transmission with ZF equalizer% the number of tap of the equalizer is 3%Author: Group %Create date: 2008-11-16%-------------------------------------------------------%clear all;close all;training_bits = [1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1];vv =zeros(1,4);%retrain the channel for several times to get accurate estimationtrain_time = 100;%for (ii = 1:train_time) v = linch(training_bits); %pass through the channel% vv = vv + v(1:4);%end%vv = vv/train_time;% U = [vv(3) vv(2) vv(1);% vv(4) vv(3) vv(2);% 0 vv(4) vv(3)]';U = [v(11) v(10) v(9) v(8) v(7) v(6) v(5); v(12) v(11) v(10) v(9) v(8) v(7) v(6); v(13) v(12) v(11) v(10) v(9) v(8) v(7); v(14) v(13) v(12) v(11) v(10) v(9) v(8); v(15) v(14) v(13) v(12) v(11) v(10) v(9); v(16) v(15) v(14) v(13) v(12) v(11) v(10); v(17) v(16) v(15) v(14) v(13) v(12) v(11)];P = inv(U);Czf = P*[0;0;0;1;0;0;0];buf_BER = [];N = 10;bn = sign(rand(1,N)-0.5);rn = linch(bn);re = conv(rn,Czf);bn_est = sign(re); %shift the position to avoid time delay%BER = sum(abs(bn_est - bn)/2)/N;%calculate BER%buf_BER = [buf_BER BER]; %buf the result%test the zero forcing equalizer% test_time = 100;% buf_BER = [];% % test for more times for ploting% for(ii = 1:test_time)% N = 100000;% bn = sign(rand(1,N)-0.5);% rn = linch(bn);% re = conv(rn,Czf);% bn_est = sign(re(4:N+3)); %shift the position to avoid time delay% BER = sum(abs(bn_est - bn)/2)/N;%calculate BER% buf_BER = [buf_BER BER]; %buf the result% end% %draw the target BER% target = zeros(1,length(buf_BER))+ 0.005;% figure(1)% n = 1:length(buf_BER);% plot(n,target,'r-.');% hold on;% %draw the real BER% plot(buf_BER,'x');% axis([1 test_time 0 0.05]);% legend('Target BER','Real BER');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -