MIMO-OFDM自适应程序

  • b0_721978
    了解作者
  • 11.2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-20 01:21
    上传日期
这是一个MIMO系统下的OFDM自适应均衡算法。
MIMO-OFDM自适应程序.rar
  • MIMO-OFDM自适应程序
  • channel.m
    735B
  • rx_demodulate.m
    590B
  • mimo_corr.m
    919B
  • main.m
    67B
  • transmitter.m
    607B
  • mimo_channel.m
    874B
  • rx_qam16_demod.m
    475B
  • receiver.m
    763B
  • tx_diversity4.m
    2.8KB
  • rx_qpsk_demod.m
    265B
  • ui_start_sim.m
    172B
  • tx_diversity2.m
    2.8KB
  • rx_diversity_proc1.m
    1.4KB
  • tx_diversity1.m
    776B
  • single_packet.m
    2KB
  • tx_diversity3.m
    2.8KB
  • rx_bpsk_demod.m
    88B
  • runsim.m
    4KB
  • tx_modulate.m
    2.2KB
  • rx_qam64_demod.m
    1.4KB
  • rx_diversity_proc2.m
    4KB
内容介绍
function runsim(sim_options) % set constants used in simulation %set_sim_consts;目前不用 % Set Random number generators initial state % reset random number generators based on current clock value rand('state',sum(100*clock)) randn('state',sum(100*clock)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Main simulation loop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Initialize simulation timer start_time = clock; % Initialize trellis tables for Viterbi decoding % rx_init_viterbi;目前不用 % counters for information bits %inf_per = 0; % counters for raw (uncoded) bits %num_raw_bits = 0; %num_raw_bit_errors = 0; %num_raw_packet_errors = 0; %raw_ber = 0; %raw_per = 0; n_tx=2; n_rx=2; % Simulation the number of packets specified packet_count = 0; while packet_count < sim_options.PacketToSim packet_count = packet_count + 1; packet_start_time = clock; BERtotal=zeros(1,20);%所有错误比特/所有发送数据 num_total_bits=zeros(1,20);%所有发送数据 %引入两个量,用于记录总的误码情况,调整门限 %NTOTAL=zeros(1,20); %BTOTAL=zeros(1,20); BER_sta=0; for i=1:20 SNR(i)=i+5; % Simulate one packet with the current options num_inf_bits = 0; num_inf_bit_errors = 0; %num_inf_packet_errors = 0; inf_ber(i) = 0; [txsignal, tx_inf_bits, rxsignal, inf_bit_cnt, inf_bit_errors] = single_packet(sim_options, SNR(i),BER_sta,n_tx,n_rx); num_inf_bits = num_inf_bits + inf_bit_cnt;%因为num_inf_bits=0,所以就应该删除参数num_inf_bits num_inf_bit_errors = num_inf_bit_errors + inf_bit_errors;%因为num_inf_bit_errors =0,所以就应该删除参数num_inf_bit_errors %num_inf_packet_errors = num_inf_packet_errors + (inf_bit_errors~=0); inf_ber(i) = num_inf_bit_errors/num_inf_bits; if i==1 num_total_bits(i)=inf_bit_cnt; BERtotal(i)=inf_bit_errors; %BTOTAL(i)=inf_bit_errors; %NTOTAL(i)=inf_bit_cnt; else num_total_bits(i)=num_total_bits(i-1)+inf_bit_cnt; BERtotal(i)=BERtotal(i-1)+ inf_bit_errors; %BTOTAL(i)=BTOTAL(i-1)+BERtotal(i); %NTOTAL(i)=NTOTAL(i-1)+num_total_bits(i); end %BER_sta=BTOTAL(i)/NTOTAL(i); BER_sta=BERtotal(i)/num_total_bits(i); B(i)=BER_sta %C=log(det(eye(2)+SNR(i)*eye(2)*ones(2,2))); %inf_per = num_inf_packet_errors/packet_count; %num_raw_bits = num_raw_bits + raw_bits_cnt; %num_raw_bit_errors = num_raw_bit_errors + raw_bit_errors; %num_raw_packet_errors = num_raw_packet_errors + (raw_bit_errors~=0); %raw_ber = num_raw_bit_errors/num_raw_bits; %raw_per = num_raw_packet_errors/packet_count; %SNR %num_inf_bits %num_inf_bit_errors %num_total_bits fprintf('SNR:%8d; ERROR NUM:%8d\n',SNR(i), num_inf_bit_errors); end %SNR %BERtotal %num_total_bits packet_stop_time = clock; packet_duration = etime(packet_stop_time, packet_start_time); %plot(SNR, inf_ber) %num_total_bits semilogy(SNR,inf_ber) hold on semilogy(SNR,B) %figure(2) %semilogy(SNR,BERtotal./num_total_bits) %figure(1) %plot(SNR,num_total_bits/sim_options.PacketLength) %Display results; %fprintf('%8s %8s %9s %10s %8s %10s %10s %9s\n', ... % ' Packet |', ' Time |', 'raw errs |', ' raw BER |', 'data errs |',' data BER |', ' raw PER |', 'data PER'); %fprintf('%7d |%7g | %8d |%10.2e |%10d |%10.2e |%10.2e |%10.2e\n',... % packet_count, packet_duration, raw_bit_errors, raw_ber, inf_bit_errors, inf_ber, raw_per, inf_per); %num_inf_bits %num_inf_bit_errors %fprintf('SNR:%d',SNR,'BER:%10.2e',inf_ber); % read event queue %drawnow; end stop_time = clock; elapsed_time = etime(stop_time,start_time); fprintf('Simulation duration: %g seconds\n',elapsed_time);
评论