📄 transmit.m
字号:
% This code is to generate the transmitted packets and symbols
% active_ii
% h: channel
% subch: the subchannel used to transmit
% G: number of total subchannels
% trs_bit: transmitted bits
% transmitted signal
function [trs_bit,Y]=transmit(active_ii,h,subch,G)
J = 32; % total number of users
NF=64; % total number of carriers
Ng=48/G; % the number of carriers of each subchannel
NP=8; % the length of prefix
Pref=NP; % the length of CP
L=3; % the length of FIR channel
NN=1000*1; % block size
N=NN*Ng; % total symbol number of one packet in one slot
N1 = N - Ng*J; %number of data symbols per packet (QPSK)
ID = hadamard(J)+j*hadamard(J);
pack=sign(rand(N1,1)-0.5)+j*sign(rand(N1,1)-0.5);
trs_bit=[];
%To guarantee the performance of channel estimation,
%sd here used pilots in each carrier (even though it is not necessary
%because there is a lot of frequency redundancy
for ii=1:J
temp=[ID(ii,active_ii)* ones(Ng,1)];
trs_bit=[trs_bit; temp];
end
trs_bit=[trs_bit; pack];
trs_bit1=reshape(trs_bit,Ng,floor(length(trs_bit)/Ng));
x=zeros(NF,floor(length(trs_bit)/Ng));
x(8+((subch-1)*Ng+1:subch*Ng),:)=trs_bit1; % information symbols only occupy some positions
% IFFT
X=ifft(x,NF)*sqrt(NF);
% .add cyclic prefix
X1=[X(NF-(Pref-1):NF,:); X];
X1=reshape(X1,1,prod(size(X1)));
%.....convolution with the FIR channel - channel changes between blocks.....
Y=filter(h,1,X1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -