%设置参数调制类型clc;关闭所有;清除所有;data = randint (2000 1 (1,0));%生成1000位的二进制数据1和0 mod_type =输入(“输入调制类型[1 BPSK, 2正交相移编码,3 16 qam, 4 64 qam]:”);norm_factor = (1.0; 0.7071; 0.3162; 0.1543);%标准化因素,1.0:0.7071:BPSK, QPSK, 0.3162:16qam 0.1543:64qam数控= [1,2,4,6];%每副载波的比特数,1:BPSK, 2: QPSK, 4:16QAM, 6:64QAM input_seq =数据;k = norm_factor (mod_type);模式=数控(mod_type); % Selecting constellation point as per modulation type switch mode case 1 b=k*[1 -1]; case 2 b=k*[1+1i -1+1i 1-1i -1-1i]; case 4 b=k*[1+1i 1+3i 1-1i 1-3i 3+1i 3+3i 3-1i 3-3i -1+1i -1+3i -1-1i -1-3i -3+1i -3+3i -3-1i -3-3i]; case 6 b=k*[3+3i 3+1i 3+5i 3+7i 3-3i 3-1i 3-5i 3-7i 1+3i 1+1i 1+5i 1+7i 1-3i 1-1i 1-5i 1-7i 5+3i 5+1i 5+5i 5+7i 5-3i 5-1i 5-5i 5-7i 7+3i 7+1i 7+5i 7+7i 7-3i 7-1i 7-5i 7-7i -3+3i -3+1i -3+5i -3+7i -3-3i -3-1i -3-5i -3-7i -1+3i -1+1i -1+5i -1+7i -1-3i -1-1i -1-5i -1-7i -5+3i -5+1i -5+5i -5+7i -5-3i -5-1i -5-5i -5-7i -7+3i -7+1i -7+5i -7+7i -7-3i -7-1i -7-5i -7-7i]; end count=1; count1=1; for i=1:(ceil(length(input_seq)/mode)) temp=0; for j=1:mode temp=bitor(temp,bitshift(input_seq(count),(j-1))); count=count+1; if(count>length(input_seq)) break; end end map_out(count1)=b(temp+1); count1=count1+1; end figure;plot(real(map_out),imag(map_out),'r.');title('constellation'); m1=mean(abs(map_out)); % Applying channel ts=(256/4e6); doppler=0.25; tau=[0.0 0.5 0.95]; pdb=[0 -15 -25]; chan = rayleighchan(ts,doppler,tau,pdb); %TS is the sample time of the input %0.1e-3; %signal, in seconds. FD is the maximum Doppler shift, in Hertz. %100 Hz map_out_chl=filter(chan,map_out); % Plotting CCDF Curve figure; [N,Z3] = hist(abs(map_out_chl), 1000); semilogy(Z3,1-cumsum(N)/max(cumsum(N)),'black') hold off title ('CCDF') grid on;
Baidu