📄 detector.m
字号:
function [rA_data_I, rA_data_Q, rB_data_I, rB_data_Q] = Detector(H_hat_2,rA_data_I, rA_data_Q, rB_data_I, rB_data_Q,type,SNR)
% function [rA_data_I, rA_data_Q, rB_data_I, rB_data_Q] = Detector(H_hat_2,Y,type,SNR)
% S_type = (s1;s2) detected
% rA_data_I, rA_data_Q, rB_data_I, rB_data_Q, the real parts and imag parts
% of s1 and s2 respectively.
% H_hat_2 estimated channel matrix
% Y received vector
% type different criteria
% SNR Signal to Noise Ritio in dB
%
% By Jinfeng Du
% 05-04-22
ML = 1;
JMMSE = 2;
ZF = 3;
if nargin<3
type = JMMSE;
end
if nargin<4
SNR = 20;%in dB
end
if type ~= ML
Y = [rA_data_I + j* rA_data_Q; rB_data_I+ j*rB_data_Q];
end
if type == ML
[rA_data_I, rA_data_Q, rB_data_I, rB_data_Q] = MLDetector(H_hat_2, rA_data_I, rA_data_Q, rB_data_I, rB_data_Q);
elseif type == JMMSE
% Detect using JMMSE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
G_JMMSE = inv(H_hat_2'*H_hat_2+10^(-SNR/10.0)*eye(2))*H_hat_2';
S_JMMSE = G_JMMSE * Y;
rA_data_I = real(S_JMMSE(1,:));
rA_data_Q = imag(S_JMMSE(1,:));
rB_data_I = real(S_JMMSE(2,:));
rB_data_Q = imag(S_JMMSE(2,:));
elseif type == ZF
% Detect using Zero-Forcing%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
G_ZF = inv(H_hat_2'*H_hat_2)*H_hat_2';
S_ZF = G_ZF * Y;
rA_data_I = real(S_ZF(1,:));
rA_data_Q = imag(S_ZF(1,:));
rB_data_I = real(S_ZF(2,:));
rB_data_Q = imag(S_ZF(2,:));
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -