# MATLAB代做-python代做-ML接收器

### 时间：2019-4-22 16:30:26 点击：

核心提示：MATLAB代做-python代做-ML接收器...

function [bhat] = ML_detector(r_SD,r_RD,ahat_SD,ahat_RD,noise_var,eps)

%ML detector
j =sqrt(-1);

s1 = 1/sqrt(2)*(1+j);
s2 = 1/sqrt(2)*(1-j);
s3 = 1/sqrt(2)*(-1-j);
s4 = 1/sqrt(2)*(-1+j);
s = [s1 s2 s3 s4];
b = [0 0 0 1 1 1 1 0];
bhat = zeros(1,2*length(r_SD));
%N0 = 1;

b_tr = RALEY_SETTINGS.b_tr_I;
cc1 = ahat_SD* qpsk(b_tr);
cc2 = ahat_RD* qpsk(b_tr);
N0_SD = norm( r_SD(1:length(qpsk(b_tr)))-cc1 )^2/length(cc1);
N0_RD = norm( r_RD(1:length(qpsk(b_tr)))-cc2 )^2/length(cc2);
%     N0_SD = 0.5;
%     N0_RD = 0.5;
for i =1:length(r_SD)
d1 = (1/(pi*N0_SD))*exp(-norm(r_SD(i)-ahat_SD*s(1))^2/ N0_SD)*...
( (1-eps)^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(1))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(2))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(4))^2/N0_RD) +...
eps^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(3))^2/N0_RD) );

d2 = (1/(pi*N0_SD))*exp(-norm(r_SD(i)-ahat_SD*s(2))^2/ N0_SD)*...
( (1-eps)^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(2))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(1))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(3))^2/N0_RD) +...
eps^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(4))^2/N0_RD) );

d3 = (1/(pi*N0_SD))*exp(-norm(r_SD(i)-ahat_SD*s(3))^2/ N0_SD)*...
( (1-eps)^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(3))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(2))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(4))^2/N0_RD) +...
eps^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(1))^2/N0_RD) );

d4 = (1/(pi*N0_SD))*exp(-norm(r_SD(i)-ahat_SD*s(4))^2/ N0_SD)*...
( (1-eps)^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(4))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(1))^2/N0_RD) +...
eps*(1-eps)*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(3))^2/N0_RD) +...
eps^2*(1/(pi*N0_RD))*exp(-norm(r_RD(i)-ahat_RD*s(2))^2/N0_RD) );

d = [d1 d2 d3 d4];

bhat(2*i-1) = b(1);
bhat(2*i)   = b(2);
d_max= d(1);
for j =2:4
if  (d_max <d(j))
d_max = d(j);
bhat(2*i-1) = b(2*j-1);
bhat(2*i)   = b(2*j);
end
end

end

QQ ：1224848052

Tags:ML

• 百度搜索