資源簡(jiǎn)介
OFDM中LS和DFT信道估計(jì)算法matlab程序?qū)崿F(xiàn)及比較
代碼片段和文件信息
clear?all;
close?all;
fprintf(‘OFDM信道估計(jì)仿真\n\n‘);
carrier_count=64;%-----------載波數(shù)目
num_symbol=50;%--------------OFDM符號(hào)個(gè)數(shù)
Guard=8;%--------------------循環(huán)前綴
pilot_Inter=8;%--------------導(dǎo)頻間隔
modulation_mode=16;%---------調(diào)制方式
SNR=[0:2:20];%-------------信噪比取值
NumLoop=15;%-----------------循環(huán)次數(shù)
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);
%%%%%%%%%%%%%%%%%%%%%%%主程序循環(huán)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for?c1=1:length(SNR)
????fprintf(‘\n\n\n仿真信噪比為%f\n\n‘SNR(c1));
????for?num1=1:NumLoop
????????%---------------產(chǎn)生發(fā)送的隨機(jī)序列——————————————-
????????BitsLen=carrier_count*num_symbol;
????????BitsTx=randint(1BitsLen);
????????%---------------符號(hào)調(diào)制---------------------------------------
????????Modulated_Sequence=qammod(BitsTxmodulation_mode);
????????%---------------導(dǎo)頻格式---------------------------------------
????????pilot_len=carrier_count;
????????pilot_symbols=round(rand(1pilot_len));
????????for?i=1:pilot_len
????????????if?pilot_symbols(1i)==0
????????????????pilot_symbols(1i)=pilot_symbols(1i)-1;
????????????else
????????????????pilot_symbols(1i)=pilot_symbols(1i);
????????????end
????????end
????????pilot_symbols=pilot_symbols‘;
????????%----------------計(jì)算導(dǎo)頻和數(shù)據(jù)數(shù)目----------------------------
????????num_pilot=ceil(num_symbol/pilot_Inter);
????????if?rem(num_symbolpilot_Inter)==0
????????????num_pilot=num_pilot+1;
????????end
????????num_data=num_symbol+num_pilot;
????????%----------------導(dǎo)頻位置計(jì)算----------------------------------
????????pilot_Indx=zeros(1num_pilot);
????????Data_Indx=zeros(1num_pilot*(pilot_Inter+1));
????????for?i=1:num_pilot-1
????????????pilot_Indx(1i)=(i-1)*(pilot_Inter+1)+1;
????????end
????????pilot_Indx(1num_pilot)=num_data;
????????for?j=0:num_pilot
????????????Data_Indx(1(1+j*pilot_Inter):(j+1)*pilot_Inter)=(2+j*(pilot_Inter+1)):((j+1)*(pilot_Inter+1));
????????end
????????Data_Indx=Data_Indx(11:num_symbol);
????????%----------------導(dǎo)頻插入-------------------------------------
????????piloted_ofdm_syms=zeros(carrier_countnum_data);
????????piloted_ofdm_syms(:Data_Indx)=reshape(Modulated_Sequencecarrier_countnum_symbol);
????????piloted_ofdm_syms(:pilot_Indx)=repmat(pilot_symbols1num_pilot);
????????%----------------IFFT變換———————————————————
????????time_signal=sqrt(carrier_count)*ifft(piloted_ofdm_syms);
????????%----------------加循環(huán)前綴------------------------------------
????????add_cyclic_signal=[time_signal((carrier_count-Guard+1:carrier_count):);time_signal];
????????Tx_data_trans=reshape(add_cyclic_signal1(carrier_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));
??
評(píng)論
共有 條評(píng)論