附 录程序:clear allclose allfprintf('OFDM
信道估计仿真\n\n')carrier_count=64%-----------
载波数目核岁num_symbol=50%--------------OFDM符号个数Guard=8%--------------------循环前缀pilot_Inter=8%--------------导频间隔modulation_mode=16%---------调制方式SNR=[0:2:20]%-------------信噪比取值NumLoop=15%-----------------循环次数num_bit_err=zeros(length(SNR),NumLoop)num_bit_err_dft=zeros(length(SNR),NumLoop)num_bit_err_ls=zeros(length(SNR),NumLoop)MSE=zeros(length(SNR),NumLoop)MSE1=zeros(length(SNR),NumLoop)MSE2=zeros(length(SNR),NumLoop)%%%%%%%%%%%%%%%%%%%%%%%主程序镇虚循环%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%for c1=1:length(SNR)fprintf('\n\n\n仿真信噪比为%f\n\n',SNR(c1))for num1=1:NumLoop%---------------产生发送的随机序列——————————改旅睁————-BitsLen=carrier_count*num_symbolBitsTx=randint(1,BitsLen)%---------------符号调制---------------------------------------Modulated_Sequence=qammod(BitsTx,modulation_mode)%---------------导频格式---------------------------------------pilot_len=carrier_countpilot_symbols=round(rand(1,pilot_len))for i=1:pilot_lenif pilot_symbols(1,i)==0pilot_symbols(1,i)=pilot_symbols(1,i)-1elsepilot_symbols(1,i)=pilot_symbols(1,i)endendpilot_symbols=pilot_symbols'%----------------计算导频和
数据数目----------------------------num_pilot=ceil(num_symbol/pilot_Inter)if rem(num_symbol,pilot_Inter)==0num_pilot=num_pilot+1endnum_data=num_symbol+num_pilot%----------------导频位置计算----------------------------------pilot_Indx=zeros(1,num_pilot)Data_Indx=zeros(1,num_pilot*(pilot_Inter+1))for i=1:num_pilot-1pilot_Indx(1,i)=(i-1)*(pilot_Inter+1)+1endpilot_Indx(1,num_pilot)=num_datafor j=0:num_pilotData_Indx(1,(1+j*pilot_Inter):(j+1)*pilot_Inter)=(2+j*(pilot_Inter+1)):((j+1)*(pilot_Inter+1))endData_Indx=Data_Indx(1,1:num_symbol)%----------------导频插入-------------------------------------piloted_ofdm_syms=zeros(carrier_count,num_data)piloted_ofdm_syms(:,Data_Indx)=reshape(Modulated_Sequence,carrier_count,num_symbol)piloted_ofdm_syms(:,pilot_Indx)=repmat(pilot_symbols,1,num_pilot)%----------------IFFT变换———————————————————time_signal=sqrt(carrier_count)*ifft(piloted_ofdm_syms)%----------------加循环前缀------------------------------------add_cyclic_signal=[time_signal((carrier_count-Guard+1:carrier_count),:)time_signal]Tx_data_trans=reshape(add_cyclic_signal,1,(ca rrier_count+Guard)*num_data)%----------------信道处理--------------------------------------Tx_signal_power=sum(abs(Tx_data_trans(:)).^2)/length(Tx_data_trans(:))noise_var=Tx_signal_power/(10^(SNR(c1)/10))Rx_data=awgn(Tx_data_trans,SNR(c1),'measured')%----------------信号接收、去循环前缀、FFT变换-----------------Rx_signal=reshape(Rx_data,(carrier_count+Guard),num_data)Rx_signal_matrix=zeros(carrier_count,num_data)Rx_signal_matrix=Rx_signal(Guard+1:end,:)Rx_carriers=fft(Rx_signal_matrix)/sqrt(carrier_count)%----------------导频和数据提取--------------------------------Rx_pilot=Rx_carriers(:,pilot_Indx)Rx_fre_data=Rx_carriers(:,Data_Indx)%----------------导频位置信道响应LS估计------------------------pilot_patt=repmat(pilot_symbols,1,num_pilot)pilot_esti=Rx_pilot./pilot_patt%----------------LS估计的线性插值———————————————int_len=pilot_Indxlen=1:num_datafor ii=1:carrier_countchannel_H_ls(ii,:)=interp1(int_len,pilot_esti(ii,1:(num_pilot)),len,'linear')endchannel_H_data_ls=channel_H_ls(:,Data_Indx)%----------------LS估计中发送数据的估计值----------------------Tx_data_estimate_ls=Rx_fre_data.*conj(channel_H_data_ls)./(abs(channel_H_data_ls).^2)%----------------DFT估计--------------------------------------Tx_pilot_estimate_ifft=ifft(pilot_esti)padding_zero=zeros(1024,7)Tx_pilot_estimate_ifft_padding_zero=[Tx_pilot_estimate_ifftpadding_zero]Tx_pilot_estimate_dft=fft(Tx_pilot_estimate_ifft_padding_zero)%----------------DFT估计的线性插值———————————————int_len=pilot_Indxlen=1:num_datafor ii=1:carrier_countchannel_H_dft(ii,:)=interp1(int_len,Tx_pilot_estimate_dft(ii,1:(num_pilot)),len,'linear')endchannel_H_data_dft=channel_H_dft(:,Data_Indx)%----------------DFT估计中发送数据的估计值----------------------Tx_data_estimate_dft=Rx_fre_data.*conj(channel_H_data_dft)./(abs(channel_H_data_dft).^2)%----------------DFT符号解调------------------------------------demod_in_dft=Tx_data_estimate_dft(:).'demod_out_dft=qamdemod(demod_in_dft,modulation_mode)%----------------LS符号解调------------------------------------demod_in_ls=Tx_data_estimate_ls(:).'demod_out_ls=qamdemod(demod_in_ls,modulation_mode)%----------------误码率的计算----------------------------------for i=1:length(BitsTx)if demod_out_dft(i)~=BitsTx(i)num_bit_err_dft(c1,num1)=num_bit_err_dft(c1,num1)+1endif dem od_out_ls(i)~=BitsTx(i)num_bit_err_ls(c1,num1)=num_bit_err_ls(c1,num1)+1endendendendBER_dft=mean(num_bit_err_dft.')/length(BitsTx)BER_ls=mean(num_bit_err_ls.')/length(BitsTx)%%%%%%%%%%%%%%%%%%%a%%%%%%%%主程序循环换结束%%%%%%%%%%%%%%%%%%%%%%%%%%%%figuresemilogy(SNR,BER_dft,'-mp',SNR,BER_ls,'-k+')title('OFDM系统的LS和DFT信道估计')xlabel('SNR'),ylabel('BER')legend('LS信道估计','DFT信道估计')
人为地增加图像的分辨率。不生成像素的情况下增加图像像素大小的粗姿一种方法,在周围像素色彩的基础上用数学公式计算丢失像素的色彩。有些相机使用插值,人为地增加图像的分辨率。
信道估计算法从输入数据的类型来分,可以划分为时域和频域两大类方法。频域方法主要针对多载波统,时域方法适用于所有单载波和多载波察启系统,其借助于参考信号或发送数据的统计特性,估计衰落信岩没绝道中各多径分量的衰落系数。
评论列表(0条)