📄 stbcg2_tx.m
字号:
function [Sv,rx,G,symb]=stbcG2_tx(snr,Hh,delay)
%This routine generates the received data but with Non-Gaussian Noise.
%H is TRUE channel matrix
%stbc is which stbc to use
%symb are the true symbols to be used for error rate later
%rx is the simulated received data
%G is the transmitted stbc matrix
%Note: set epsilon = 0 to obtain pure gaussian noise.
global nTx nRx Mary Smap epsilon kappa
%G2 : | x1 -x2* |
% | x2 x1* |
%H=(randn(nRx,nTx) + i*randn(nRx,nTx))/sqrt(2); %FOR RAYLEIGH TESTING !!!
rx = zeros(nRx,delay);
%Randomly pick symbol's index
symb=ceil(rand(nTx,1)*Mary);
%Encode using PSK modulation
[Sv]=psk_gen(Mary,symb);
%Transmit Coding Matrix
G = [ Sv(1) -Sv(2)';
Sv(2) Sv(1)'];
%Noise Stats
Eav=Smap'*Smap/Mary;
NP = 10*log10(Eav) - snr; %NP only in dB (for PSK signal power is 0 dB)
sigma2 = 10^(NP/10);
NF2 = sigma2 / ((1-epsilon) + (kappa*epsilon));
%Received Signal from Across Channel
for d = 1:delay
u = rand(1);
if u < epsilon
noise = sqrt(kappa*nTx*NF2/2)*(randn(nRx,1) + i*randn(nRx,1));
else
noise = sqrt(nTx*NF2/2)*(randn(nRx,1) + i*randn(nRx,1));
end
rx(:,d) = Hh(:,:,d)*G(:,d) + noise;
end
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -