下图为我的仿真图:
求助怎样得到图片中的ML曲线的仿真结果?
下面为我的源程序:
close all;
clear all;
(1) Nt = 2;
% Number of transmit antennas.
(2) Nr = 2;
% Number of receive antennas.
(3) M = 4;
% 4-QAM modulation.
(4) L = 1000;
% Length of transmit signal.
(5) SNRdB = 8;
% SNR in dB.
(6) SNR = 10.O(SNRdB/10);
(7) var = 1./(SNR*log2(M));
(8) ALP = [-1+i -1-i 1+i 1-i]*sqrt(3/(2*(M-1)));
% Signal alphabet in QAM.
(9) ALPbin = dec2bin([0:M-1],log2(M));
% Signal alphabet in binary coding.
(10) s = ALP(randint(Nt,L,[1 M]));
% Random transmit signal in QAM.
(11) i = 0;
(12) for u = 1
(13) for v = 1:Nt
(14) i = i+1;
(15) sbin(i, = ALPbin(find(ALP==s(v,u)),;
% Random transmit signal in binary codes.
(16) end
(17) end
(18) H = (randn(Nr,Nt)+sqrt(-1)*randn(Nr,Nt))/sqrt(2);
% Channel matrix.
(19) n = (randn(Nr,L)+sqrt(-1)*randn(Nr,L))*sqrt(var)/sqrt(2);
% AWGN noise.
(20) y = H*s+n;
% Received signal.
以上为Table 1.1的内容
(1) Input: fy,H,sbin,Nt,L,M,ALP,ALPbing
% Output from Table 1.1.
(2) dml = zeros(M,M,L);
(3) kset = zeros(Nt,L);
(4) ibin = 0;
% Initialization of parameters.
(5) for u = 1
(6) for i1 = 1:M
(7) for i2 = 1:M
(8) dml(i1,i2,u) = (norm(y(:,u)-H*[ALP(i1);ALP(i2)]))O2;
% ML function with an exhaustive search.
(9) end
(10) end
(11) dmin = 1e8;
% Define a small value.
(12) for j1 = 1:M
(13) for j2 = 1:M
(14) if dml(j1,j2,u) < dmin
(15) dmin = dml(j1,j2,u);
% Find the index of detected symbols.
(16) kset(1,u) = j1;
(17) kset(2,u) = j2;
(18) end
(19) end
(20) end
(21) hats(1,u) = ALP(kset(1,u));
(22) hats(2,u) = ALP(kset(2,u));
% Map the detected signals in QAM.
(23) hatsbin(ibin+1, = ALPbin(find(hats(1,u)==ALP),;
(24) hatsbin(ibin+2, = ALPbin(find(hats(2,u)==ALP),;
% Map the detected signals in binary codes.
(25) ibin = ibin+2;
(26) end
(27) BER = mean(reshape(abs(sbin-hatsbin),1,Nt*L*log2(M)));
% Generate the BER at bits level. |
|
|
|
|
共 5 个关于本帖的回复 最后回复于 2015-1-13 19:30