已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
clc;clear;%参数初始化i=sqrt(-1);awgn=0; % 定义高斯信道se=0; % 估计技术nse=64; % OFDM载波个数ng=16; % 循环前缀长度SNR=0 5 10 15 20 25 30 35 40; % 信噪比mt=2; % 发送天线mr=2; % 接收天线pilot=1:nse/ng:nse; % 子带载波 ds=5; % 信道延迟number=200;%= N=50; fm=100; B=20e3; fd=(rand(1,N)-0.5)*2*fm; theta=randn(1,N)*2*pi; c=randn(1,N); c=c/sum(c.2); t=0:fm/B:10000*fm/B; T_c=zeros(size(t); T_s=zeros(size(t); for k=1:N T_c=c(k)*cos(2*pi*fd(k)*t+theta(k)+T_c; T_s=c(k)*sin(2*pi*fd(k)*t+theta(k)+T_s; end r=ones(mt*mr,1)*(T_c.2+T_s.2).0.5; index=floor(rand(mt*mr,ds)*5000+1);MEE1=zeros(1,length(SNR);MEE2=zeros(1,length(SNR);for snrl=1:length(SNR) snrl estimation_error1=zeros(mt*mr,nse); estimation_error2=zeros(mt*mr,nse); R1=besselj(0,2*pi*fm*(nse+ng)/B); sigma2=10(-SNR(snrl)/10); aa=(1-R12)/(1-R12+sigma2); bb=sigma2*R1/(1-R12+sigma2); for iteration=1:number if awgn=1 h=ones(mt*mr,1); else phi=rand*2*pi; h=r(index+iteration)*exp(j*phi); h=h.*(ones(mt*mr,1)*(exp(-0.5).1:ds); h=h./(sqrt(sum(abs(h).2,2)*ones(1,ds); end % 信道长度 CL=size(h,2); data_time=zeros(mt,nse+ng); data_qam=zeros(mt,nse); data_out=zeros(mr,nse); output=zeros(mr,nse); for tx=1:mt data_b=0*round(rand(4,nse); data_qam(tx,:)=j*(2*(mod(data_b(1,:)+data_b(2,:),2)+2*data_b(1,:)-3)+2*(mod(data_b(3,:)+data_b(4,:),2)+2*data_b(3,:)-3; for loop=1:mt data_qam(tx,pilot+loop-1)=(1+j)*(loop=tx); end data_time_temp=ifft(data_qam(tx,:); data_time(tx,:)=data_time_temp(end-ng+1:end) data_time_temp; end for rx=1:mr for tx=1:mt output_temp=conv(data_time(tx,:),h(rx-1)*mt+tx,:); output(rx,:)=output_temp(ng+1:ng+nse)+output(rx,:); end np=(sum(abs(output(rx,:).2)/length(output(rx,:)*sigma2; noise=(randn(size(output(rx,:)+i*randn(size(output(rx,:)*sqrt(np); output(rx,:)=output(rx,:)+noise; data_out(rx,:)=fft(output(rx,:); end %信道估计 H_act=zeros(mt*mr,nse); H_est1=zeros(mt*mr,nse); H_est2=zeros(mt*mr,nse); i=1; for tx=1:mt for rx=1:mr H_est_temp=data_out(rx,pilot+tx-1)./data_qam(tx,pilot+tx-1); h_time=ifft(H_est_temp); h_time=h_time zeros(1,nse-length(h_time); H_est1(rx-1)*mt+tx,:)=fft(h_time); H_est2(rx-1)*mt+tx,:)=(aa*abs(H_est1(rx-1)*mt+tx,:)+bb*abs(H_est2(rx-1)*mt+tx,:). .*H_est1(rx-1)*mt+tx,:)./abs(H_est1(rx-1)*mt+tx,:); if (tx1) H_est1(rx-1)*mt+tx,:)=H_est1(rx-1)*mt+tx,nse-tx+2:nse) H_est1(rx-1)*mt+tx,1:nse-tx+1); H_est2(rx-1)*mt+tx,:)=H_est2(rx-1)*mt+tx,nse-tx+2:nse) H_est2(rx-1)*mt+tx,1:nse-tx+1); end H_act(rx-1)*mt+tx,:)=fft(h(rx-1)*mt+tx,:) zeros(1,nse-CL); error1=(abs(H_act(rx-1)*mt+tx,:)-H_est1(rx-1)*mt+tx,:).2); error2=(abs(H_act(rx-1)*mt+tx,:)-H_est2(rx-1)*mt+tx,:).2); estimation_error1(rx-1)*mt+tx,:)=estimation_error1(rx-1)*mt+tx,:)+error1; estimation_error2(rx-1)*mt+tx,:)=estimation_error2(rx-1)*mt+tx,:)+error2; end end end estimation_error1=estimation_error1/number; estimation_error2=estimation_error2/number; MEE1(snrl)=sum(sum(estimation_error1)/(mt*mr*nse); MEE2(snrl)=sum(sum(estimation_error2)/(mt*mr*nse);endplot(SNR,10*log10(MEE1); hold on;plot(SNR,10*log10(MEE2),r);error1=(abs(H_act-H_est1).2)./(abs(H_act).2);error2=(abs(H_act-H_est2).2)./(abs(H_act).2);fig=4;i=1;figure(1);subplot(fig,1,i),plot(0:length(H_act)-1,abs(H_act); i=i+1;subplot(fig,1,i),plot(0:length(H_est1)-1,abs(H_est1); i=i+1;subplot(fig,1,i),plot(0:length(H_est2)-1,abs(H_est2); i=i+1;subplot(fig,1,i),plot(0:length(error1)-1,error1); i=i+1;IFFT_bin_length=128;carrier_count=100;biT_s_per_symbol=2;symbols_per_carrier=12;LI=7 ; Np=ceil(carrier_count/LI)+1;N_number=carrier_count*symbols_per_carrier*biT_s_per_symbol;carriers=1:carrier_count+Np;GI=8; N_snr=40; % 每比特信噪比snr=8; %信噪比间隔 X=zeros(1,N_number) ;XX=zeros(1,N_number) ;dif_bit=zeros(1,N_number) ;dif_bit1=zeros(1,N_number);dif_bit2=zeros(1,N_number);dif_bit3=zeros(1,N_number);X=randint(1,N_number) ;s=(X.*2-1)/sqrt(2) ;sreal=s(1:2:N_number) ;simage=s(2:2:N_number) ;%=X1=sreal+j.*simage;train_sym=randint(1,2*symbols_per_carrier);t=(train_sym.*2-1)/sqrt(2);treal=t(1:2:2*symbols_per_carrier);timage=t(2:2:2*symbols_per_carrier);training_symbols1=treal+j.*timage;training_symbols2=training_symbols1.;training_symbols=repmat(training_symbols2,1,Np);pilot=1:LI+1:carrier_count+Np;if length(pilot)=Np pilot=pilot,carrier_count+Np;end%串并转换X2=reshape(X1,carrier_count,symbols_per_carrier).;%插入导频signal=1:carrier_count+Np;signal(pilot)=;X3(:,pilot)=training_symbols;X3(:,signal)=X2;IFFT_modulation=zeros(symbols_per_carrier,IFFT_bin_length);IFFT_modulation(:,carriers)=X3;X4=ifft(IFFT_modulation,IFFT_bin_length,2);%加保护间隔(循环前缀)for k=1:symbols_per_carrier; for i=1:IFFT_bin_length; X6(k,i+GI)=X4(k,i); end for i=1:GI; X6(k,i)=X4(k,i+IFFT_bin_length-GI); endend%并串转换X7=reshape(X6.,1,symbols_per_carrier*(IFFT_bin_length+GI);%信道模型:带多普勒频移的瑞利衰落信道fd=100; %多普勒频移r=6; %多径数a=0.123 0.3 0.4 0.5 0.7 0.8; %多径的幅度d=2 3 4 5 9 13; %各径的延迟T=1; %系统采样周期th=90 0 72 144 216 288*pi./180;%相移h=zeros(1,carrier_count);hh=; for k=1:r h1=a(k)*exp(j*(2*pi*T*fd*d(k)/carrier_count); hh=hh,h1; end h(d+1)=hh;channel1=zeros(size(X7);channel1(1+d(1):length(X7)=hh(1)*X7(1:length(X7)-d(1);channel2=zeros(size(X7);channel2(1+d(2):length(X7)=hh(2)*X7(1:length(X7)-d(2);channel3=zeros(size(X7);channel3(1+d(3):length(X7)=hh(3)*X7(1:length(X7)-d(3);channel4=zeros(size(X7);channel4(1+d(4):length(X7)=hh(4)*X7(1:length(X7)-d(4);channel5=zeros(size(X7);channel5(1+d(5):length(X7)=hh(5)*X7(1:length(X7)-d(5);channel6=zeros(size(X7);channel6(1+d(6):length(X7)=hh(6)*X7(1:length(X7)-d(6);Tx_data=X7+channel1+channel2+channel3+channel4;%加高斯白噪声Error_ber=;%误比特率Error_ber1=;Error_ber2=;%误比特率Error_ber3=;for snr_db=0:snr:N_snr code_power=0; code_power=norm(Tx_data)2/(length(Tx_data); %信号的符号功率 bit_power=code_power/biT_s_per_symbol; %比特功率 noise_power=10*log10(bit_power/(10(snr_db/10);%噪声功率 noise=wgn(1,length(Tx_data),noise_power,complex);%产生GAUSS白噪声信号 Y7=Tx_data+noise; %串并变换 Y6=reshape(Y7,IFFT_bin_length+GI,symbols_per_carrier).; %去保护间隔 for k=1:symbols_per_carrier; for i=1:IFFT_bin_length; Y5(k,i)=Y6(k,i+GI); end end Y4=fft(Y5,IFFT_bin_length,2); Y3=Y4(:,carriers); %LS信道估计 H=; Y2=Y3(:,signal); Rx_training_symbols=Y3(:,pilot); Rx_training_symbols0=reshape(Rx_training_symbols,symbols_per_carrier*Np,1); training_symbol0=reshape(training_symbols,1,symbols_per_carrier*Np); training_symbol1=diag(training_symbol0); training_symbol2=inv(training_symbol1); Hls=training_symbol2*Rx_training_symbols0; Hls1=reshape(Hls,symbols_per_carrier,Np); HLs=; HLs1=; if ceil(carrier_count/LI)=carrier_count/LI for k=1:Np-1 HLs2=; for t=1:LI HLs1(:,1)=(Hls1(:,k+1)-Hls1(:,k)*(t-1)./LI+Hls1(:,k); HLs2=HLs2,HLs1; end HLs=HLs,HLs2; endelse for k=1:Np-2 HLs2=; for t=1:LI HLs1(:,1)=(Hls1(:,k+1)-Hls1(:,k)*(t-1)./LI+Hls1(:,k); HLs2=HLs2,HLs1; end HLs=HLs,HLs2; end HLs3=; for t=1:mod(carrier_count,LI) HLs1(:,1)=(Hls1(:,Np)-Hls1(:,Np-1)*(t-1)./LI+Hls1(:,Np-1); HLs3=HLs3,HLs1; end; HLs=HLs,HLs3; end Y1=Y2./HLs; %并串变换 YY=reshape(Y2.,1,N_number/biT_s_per_symbol); YY1=reshape(Y1.,1,N_number/biT_s_per_symbol);%QPSK解调 y_real=sign(real(YY); y_image=sign(imag(YY); y_re=y_real./sqrt(2); y_im=y_image./sqrt(2); y_real1=sign(real(YY1); y_image1=sign(imag(YY1); y_re1=y_real1./sqrt(2); y_im1=y_image
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 ISO 18777-2:2025 EN Transportable liquid oxygen systems for medical use - Part 2: Particular requirements for portable units
- 浙江2025年下半年桐乡市事业单位招考易考易错模拟试题(共500题)试卷后附参考答案
- 河南新郑市刑事技术鉴定服务中心招考事业单位工作人员易考易错模拟试题(共500题)试卷后附参考答案
- 江门市高新技术产业促进会招考易考易错模拟试题(共500题)试卷后附参考答案
- 分公司运营合同范本
- 冷藏出售转让协议书
- 杭州市上城区2025年下半年下半年招考50名专职社区工作者易考易错模拟试题(共500题)试卷后附参考答案
- 招商银行博士后科研工作站面向海内外招考第十一批博士后研究人员易考易错模拟试题(共500题)试卷后附参考答案
- 广州市荔湾区沙面街公房管理中心招考房屋建筑工程技术员易考易错模拟试题(共500题)试卷后附参考答案
- 供热出售协议合同书
- 甘肃开放大学2025年《地域文化(本)》形成性考核1-3终考答案
- 畜牧兽医专业职业规划
- 2026年河南女子职业学院单招职业技能考试必刷测试卷带答案
- 团干部培训分享
- 2026届湖南省华大新高考联盟高三上学期9月教学质量测评(一模)物理试题(解析版)
- 微量泵的使用方法及注意事项
- 游泳池安全保障制度和措施
- 2025年枣庄市工会社会工作者公开招聘(34人)笔试考试参考试题附答案解析
- 印花税法专项培训
- 数字化艺术-终结性考核-国开(SC)-参考资料
- 手术物品清点(获奖课件)
评论
0/150
提交评论