ISI_Length = 1;%每径延时为 ISI_Length/2.................................................22
EbN0db = [0:1:30];%信噪比,单位 db........................................................22
Tlen = 8000; %数据长度...............................................................................22
%误比特率的初始值....................................................................................22
Bit_Error_Number1 = 0;................................................................................22
Bit_Error_Number2 = 0;................................................................................22
Bit_Error_Number3 = 0;................................................................................22
%每径功率因子.............................................................................................22
power_unitary_factor1 = sqrt( 6/9 );..............................................................22
power_unitary_factor2 = sqrt( 2/9 );..............................................................22
power_unitary_factor3 = sqrt( 1/9 );..............................................................22
s_initial = randsrc( 1, Tlen ); %数据源..........................................................22
%产生 walsh 矩阵..........................................................................................22
wal2 = [ 1 1; 1 -1 ];.........................................................................................22
wal4 = [wal2 wal2; wal2 wal2*(-1)];.............................................................22
wal8 = [wal4 wal4; wal4 wal4*(-1)];.............................................................22
wal16 = [wal8 wal8; wal8 wal8*(-1)];...........................................................22
%扩频.............................................................................................................22
s_spread = zeros( Numusers, Tlen*Nc );.......................................................22
ray1 = zeros( Numusers, 2*Tlen*Nc );..........................................................22
ray2 = zeros( Numusers, 2*Tlen*Nc );..........................................................22
ray3 = zeros( Numusers, 2*Tlen*Nc );..........................................................22
for i = 1:Numusers..........................................................................................22
x0 = s_initial( i,: ).'*wal16( 8,: );...................................................................22
x1 = x0.';........................................................................................................22
s_spread( i,: ) = ( x1(:) ).';..............................................................................22
end..................................................................................................................22
%将每个扩频后的输出重复为两次,有利于下面的延迟(延迟半个码
元)................................................................................................................22
ray1( 1:2:2*Tlen*Nc - 1 ) = s_spread( 1:Tlen*Nc );.....................................22
ray1( 2:2:2*Tlen*Nc ) = ray1( 1:2:2*Tlen*Nc - 1 );.....................................22
%产生第二径和第三径信号.........................................................................23
ray2( ISI_Length + 1:2*Tlen*Nc ) = ray1( 1:2*Tlen*Nc - ISI_Length );.....23
ray2( 2*ISI_Length + 1:2*Tlen*Nc ) = ray1( 1:2*Tlen*Nc - 2*ISI_Length );
........................................................................................................................23
for nEN = 1:length( EbN0db )........................................................................23
en = 10^( EbN0db(nEN)/10 ); %将 Eb/N0 的 db 值转化成十进制数值.....23
sigma = sqrt( 32/(2*en) );..............................................................................23
%接收到的信号 demp..................................................................................23
demp = power_unitary_factor1*ray1+..........................................................23
power_unitary_factor2*ray2+.......................................................................23
power_unitary_factor3*ray3+.......................................................................23
( rand( 1,2*Tlen*Nc )+randn( 1,2*Tlen*Nc )*i )*sigma;.............................23
dt = reshape( demp,32,Tlen )';.......................................................................23