📄 interference.m
字号:
function infected =Interference(T_oWave,option)
% we generate another interferring user's data
% user1
% we first generate the 20msframe of 192 bits
info2=Data(192);
% we convolutionally encoder the user data
conv2=Conv_Encoder(info2);
% we interleave our convolutional encoded user data
int_matrix2=Interleaver(conv2);
% we generate our Long PN sequence
% starting state of the Long PN sequence generator stage register
% starting state with 41 0s and a 1
starting2=zeros([1,30]);
starting2=[starting2 ones([1,12])];
T_PN_out2=T_Long_PN(starting2);
% we decimate the Long PN chips
T_decit2=T_Decimator(T_PN_out2);
% we scramble the intereleaved user data with the decimated PN chips
T_scrambled2=T_Scrambler(T_decit2,int_matrix2);
% we walsh code our scrambed data symbols
% assume we use channel 23
chan2=33;
walshed2=Walsh_cod(T_scrambled2,chan2);
% we perform IQ modulation to our walsh coded data chips
% I and Q pilot PN sequence generator shift register starting states with 14 0s and a 1
Istarting2=zeros([1,7]);
Istarting2=[Istarting2 ones([1,8])];
Qstarting2=zeros([1,7]);
Qstarting2=[Istarting2 ones([1,8])];
T_oWave2=IQ_mod(walshed2,Istarting2,Qstarting2);
if option ~=1
%user2
% we first generate the 20ms frame of 192 bits
info3=Data(192);
% we convolutionally encoder the user data
conv3=Conv_Encoder(info3);
% we interleave our convolutional encoded user data
int_matrix3=Interleaver(conv3);
% we generate our Long PN sequence
% starting state of the Long PN sequence generator stage register
% starting state with 41 0s and a 1
starting3=zeros([1,20]);
starting3=[starting3 ones([1,22])];
T_PN_out3=T_Long_PN(starting3);
% we decimate the Long PN chips
T_decit3=T_Decimator(T_PN_out3);
% we scramble the intereleaved user data with the decimated PN chips
T_scrambled3=T_Scrambler(T_decit3,int_matrix3);
% we walsh code our scrambed data symbols
% assume we use channel 23
chan3=13;
walshed3=Walsh_cod(T_scrambled3,chan3);
% we perform IQ modulation to our walsh coded data chips
% I and Q pilot PN sequence generator shift register starting states with 14 0s and a 1
Istarting3=zeros([1,3]);
Istarting3=[Istarting3 ones([1,12])];
Qstarting3=zeros([1,3]);
Qstarting3=[Istarting3 ones([1,12])];
T_oWave2=T_oWave2+IQ_mod(walshed3,Istarting3,Qstarting3);
%user3
% we first generate the 20ms frame of 192 bits
info4=Data(192);
% we convolutionally encoder the user data
conv4=Conv_Encoder(info4);
% we interleave our convolutional encoded user data
int_matrix4=Interleaver(conv4);
% we generate our Long PN sequence
% starting state of the Long PN sequence generator stage register
% starting state with 41 0s and a 1
starting4=zeros([1,25]);
starting4=[starting4 ones([1,17])];
T_PN_out4=T_Long_PN(starting4);
% we decimate the Long PN chips
T_decit4=T_Decimator(T_PN_out4);
% we scramble the intereleaved user data with the decimated PN chips
T_scrambled4=T_Scrambler(T_decit4,int_matrix4);
% we walsh code ours crambed data symbols
% assume we use channel 36
chan4=36;
walshed4=Walsh_cod(T_scrambled4,chan4);
% we perform IQ modulation to our walsh coded data chips
% I and Q pilot PN sequence generator shift register starting states with 14 0s and a 1
Istarting4=zeros([1,9]);
Istarting4=[Istarting4 ones([1,6])];
Qstarting4=zeros([1,9]);
Qstarting4=[Istarting4 ones([1,6])];
T_oWave2=T_oWave2+IQ_mod(walshed4,Istarting4,Qstarting4);
end
if option==5
%user4
% we first generate the 20ms frame of 192 bits
info5=Data(192);
% we convolutionally encoder the user data
conv5=Conv_Encoder(info5);
% we interleave our convolutional encoded user data
int_matrix5=Interleaver(conv5);
% we generate our Long PN sequence
% starting state of the Long PN sequence generator stage register
% starting state with 41 0s and a 1
starting5=zeros([1,15]);
starting5=[starting5 ones([1,27])];
T_PN_out5=T_Long_PN(starting5);
% we decimate the Long PN chips
T_decit5=T_Decimator(T_PN_out5);
% we scramble the intereleaved user data with the decimated PN chips
T_scrambled5=T_Scrambler(T_decit5,int_matrix5);
% we Walsh code our scrambed data symbols
% assume we use channel 23
chan5=35;
walshed5=Walsh_cod(T_scrambled5,chan5);
% we perform IQ modulation to our walsh coded data chips
% I and Q pilot PN sequence generator shift register starting states with 14 0s and a 1
Istarting5=zeros([1,2]);
Istarting5=[Istarting5 ones([1,13])];
Qstarting5=zeros([1,2]);
Qstarting5=[Istarting5 ones([1,13])];
T_oWave2=T_oWave2+IQ_mod(walshed5,Istarting5,Qstarting5);
%user5
% we first generate the 20ms frame of 192 bits
info6=Data(192);
% we convolutionally encoder the user data
conv6=Conv_Encoder(info6);
% we interleave our convolutional encoded user data
int_matrix6=Interleaver(conv6);
% we generate our Long PN sequence
% starting state of the Long PN sequence generator stage register
% starting state with 41 0s and a 1
starting6=zeros([1,11]);
starting6=[starting2 ones([1,31])];
T_PN_out6=T_Long_PN(starting6);
% we decimate the Long PN chips
T_decit6=T_Decimator(T_PN_out6);
% we scramble the intereleaved user data with the decimated PN chips
T_scrambled6=T_Scrambler(T_decit6,int_matrix6);
% we walsh code our scrambed data symbols
% assume we use channel 23
chan6=58;
walshed6=Walsh_cod(T_scrambled6,chan6);
% we perform IQ modulation to our walsh coded data chips
% I and Q pilot PN sequence generator shift register starting states with 14 0s and a 1
Istarting6=zeros([1,13]);
Istarting6=[Istarting6 ones([1,2])];
Qstarting6=zeros([1,13]);
Qstarting6=[Istarting2 ones([1,2])];
T_oWave2=T_oWave2+IQ_mod(walshed6,Istarting6,Qstarting6);
end
infected=T_oWave2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -