www.pudn.com > mimoprecoding.rar > runsim.m, change:2006-07-07,size:1989b


function runsim(sim_options) 
 
%counter 
num_raw_bits          = 0; 
num_raw_bit_errors    = 0; 
num_raw_packet_errors = 0; 
raw_ber               = 0; 
raw_per               = 0; 
 
% Simulation the number of packets specified  
 packet_count = 0; 
while packet_count < sim_options.PktsToSimulate    
    packet_count = packet_count + 1; 
%    packet_start_time  = clock; 
   % Simulate one packet with the current options 
   [ raw_bits_cnt, raw_bit_errors, feedback_bits] = ... 
      single_packet(sim_options); 
%    num_inf_bits          = num_inf_bits + inf_bit_cnt; 
%    num_inf_bit_errors    = num_inf_bit_errors + inf_bit_errors; 
%    num_inf_packet_errors = num_inf_packet_errors + (inf_bit_errors~=0); 
%    inf_ber               = num_inf_bit_errors/num_inf_bits; 
%    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; 
%    packet_stop_time = clock; 
%    packet_duration = etime(packet_stop_time, packet_start_time); 
   % Display results 
%    fprintf('%8s %8s %9s %10s %10s \n', ... 
%       ' Packet |', 'raw errs |', '  raw BER |', '  raw PER |'); 
%    fprintf('\n%7d | %8d |%10.2e |%10.2e |\n____________________________________________\n\n',... 
%       packet_count, raw_bit_errors, raw_ber,  raw_per); 
   % read event queue 
   drawnow; 
end 
fid = fopen('result.txt','A'); 
fprintf(fid,'BER = %e        ',raw_ber); 
fprintf(fid,'feedback_bits = %d\n', feedback_bits); 
fclose(fid); 
%  
% stop_time = clock; 
% elapsed_time = etime(stop_time,start_time); 
%  
% fprintf('Simulation duration: %g seconds\n',elapsed_time);

2018无需申请注册送58体验金