论文总字数:21598字
毕业设计软硬件验收表
任务书规定完成的软硬件内容及规定的技术指标:(学生填写) 完成了星座的联合界及误码率仿真性能测试:联合界:clc clear all load('s'); figure(1); axis([-1 1 -1 1]); S= s(:,1) 1i.*s(:,2); scatter(real(S),imag(S)) xlabel('实数'); ylabel('虚数');title('16-QAM(12dB训练)')%随机产生星座坐标并得到星座图; p_avg=sum(sum(s.*s))/16 %点乘即两个矩阵的对应位置相乘 x_avg=sum(s(:,1))/16 y_avg=sum(s(:,2))/16 M =16; distance = 100.*ones(M,M); for i= 1: 1: M for j =1 : 1 : M if i~=j distance(i,j)=sum((s(i,:)-s(j,:)).^2,2);%b=sum(a,dim); a表示矩阵;dim等于1或者2,1表示每一列进行求和,2表示每一行进行求和;表示每列求和还是每行求和;b表示求得的行向量。 else distance(i,j)=distance(i,j); end end end min_1 = min(min(distance))%如果A是一个矩阵,min(A)将A的每一列作为一个向量,返回一行向量包含了每一列的最小元素。 array = sort(distance,1); %sort(A)若A是向量不管是列还是行向量,默认都是对A进行升序排列。sort(A)是默认的升序,而sort(A,'descend')是降序排序。 %sort(A)若A是矩阵,默认对A的各列进行升序排列 %sort(A,dim) %dim=1时等效sort(A) %dim=2时表示对A中的各行元素升序排列 I =ones(1,M); specture =reshape(distance-100.*diag(I),1,M*M); test = hist(specture,30) figure(2) stem(test) h= findobj(gca,'Type','patch'); set(h,'Facecolor',[1 1 1]) % set(gcf,'Color',[1 1 1]) %erfc估计部分(成对差错概率): p = 1 /M; Pe = zeros(1,M); %用于说明生成的误差函数的上界 pe= 0; ser_t=[]; for SNR =1:1:20 EsN0= 10^(SNR/10); for m= 1: M Sum = 0; for n=1:M if m ~= n Sum = Sum erfc(sqrt(distance(m,n))*sqrt(EsN0)*0.5)*p; end end Pe(1,m) = Sum ; end pe = 0.5* sum(Pe) ser_t=[ser_t,pe]; end % Pe(1,m)=Pe(1,m).*p; figure(3) semilogy(1:1:20,ser_t) xlabel('信噪比(SNR)'); ylabel('成对差错概率'); legend('ser_t') save('ser_t','ser_t') % Pe_max = erfc(sqrt(0.31)*sqrt(EsN0)*0.5) %%根据联合界来求性能 %Pe_U=zeros(1,16); %for SNR=1:1:16 % N0=1/(10^(SNR/10)); % Pe_U(SNR)=(16-1)/2*erfc(min_1/(2*sqrt(N0))); %end %figure(4) %SNR=1:1:16; %log_Pe_U=log10(Pe_U); %plot(SNR,log_Pe_U); %semilogy(1:1:16,Pe_U(SNR)); %for x=1:1:M % semilogy(x,Pe_U(x)); %end %xlabel('信噪比(SNR)'); %ylabel('误符号率'); %semilogy(x,Pe_U(x)); %fugure(5) 误码率仿真:symbol=50000; nb = symbol*4; data= randi([0,1],1,nb); %生成1*200000矩阵且每个元素取值随机为0或1 modu = modu_random_s(data,nb); error=0; BER = 0; snr = 1:1:8; len= length(snr); ber = []; ser=[]; %过信道 for snr =1:1:20 receive = awgn(modu,snr,'measured'); demodu = demodu_random_matrix(receive,nb); % demodu=1:1:8; % modu_2 = modu_random_s(demodu,nb); % error = sum(mod(demodu-data,2)); % ber=[ber,error/nb]; for len=1:1:symbol if(demodu(len)~=modu(len)) error = error 1;%统计差错 end end ser=[ser,error/symbol]; error = 0; end save('ser2','ser') SNR = 1:1:20; semilogy(SNR,ser,'ro-') %y轴是对数坐标系 % hold on ; % %qpsk 误比特率理论图 % r=1:0.1:8; % x=10.^(r/10); % pc=(1-0.5*erfc(sqrt(x/2))).^2; % pe=1-pc; % per=0.5*erfc(sqrt(x/2)); % % pe=erfc(sqrt(x/2)); % semilogy(r,per,'b--');grid on; % % plot(r,pe);grid on; xlabel('信噪比(dB)'); ylabel('误码率'); title('16-QAM过白噪声信道仿真图') legend('仿真值') ;grid on; %%备注:12.7dB时达到噪声容限 调制函数:function modu_data=modu_random_s(code_word,number) load s; random_s=s; for i=1:number/4 hexbit = code_word(4*i-3)*8 code_word(4*i-2)*4 code_word(4*i-1)*2 code_word(4*i)*1;%将每一位由二进制转化为十进制再用case进行判断,将数组每四位编成一组转换成十进制数,并根据十进制数进入case得到对应复数; modu(i)=random_s(hexbit 1,1) 1i*random_s(hexbit 1,2); % switch hexbit % case 0, modu(i) = random_s(1,1) 1i*random_s(1,2); % case 1, modu(i) = random_s(2,1) 1i*random_s(2,2); % case 2, modu(i) = random_s(3,1) 1i*random_s(3,2); % case 3, modu(i) = random_s(4,1) 1i*random_s(4,2); % case 4, modu(i) = random_s(5,1) 1i*random_s(5,2); % case 5, modu(i) = random_s(6,1) 1i*random_s(6,2); % case 6, modu(i) = random_s(7,1) 1i*random_s(7,2); % case 7, modu(i) = random_s(8,1) 1i*random_s(8,2); % case 8, modu(i) = random_s(9,1) 1i*random_s(9,2); % case 9, modu(i) = random_s(10,1) 1i*random_s(10,2); % case 10, modu(i) = random_s(11,1) 1i*random_s(11,2); % case 11, modu(i) = random_s(12,1) 1i*random_s(12,2); % case 12, modu(i) = random_s(13,1) 1i*random_s(13,2); % case 13, modu(i) = random_s(14,1) 1i*random_s(14,2); % case 14, modu(i)= random_s(15,1) 1i*random_s(15,2); % case 15, modu(i) = random_s(16,1) 1i*random_s(16,2); % end end load('mean_dist') %modu_data=modu./sqrt(mean_dist);%能量归一化 modu_data=modu; 解调函数:function demodu=demodu_random_matrix(ant_laymap_out,number) QAM解调 %symbol=50000; load s; random_s=s; %number=; for i=1:1:number/4 for j=1:1:16 tmp_real=real(ant_laymap_out(i)); tmp_imag=imag(ant_laymap_out(i)); 剩余内容已隐藏,请支付后下载全文,论文总字数:21598字
您需要先支付 80元 才能查看全部内容!立即支付
该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找; |