www.pudn.com > CDMA.zip > test.m


for mobiles = 10:5:50 
 
iterations = 1; 
dmin = 200; 
R = 1000; 
k = 3; 
n = 4; 
 
counterinit('outage_counter'); 
counterset('outage_counter', 0); 
 
for i = 1:iterations; 
        power_initial = -73 ; 
     
    for j = 1:mobiles; 
         
        distance  = unidrnd (R,1,mobiles) 
         
        if distance (j) <= dmin; 
             
            power (j) = k* (dmin/R)^n; 
        else  
            power (j) = k* (distance (j)/R)^n ; 
        end 
        
        SIR = (10*log10 (power (j))) 
        SIR_threshold= -14; 
        SIR_observed = SIR (j)  
       
         if SIR_observed < SIR_threshold 
           counterinc('outage_counter'); 
         end 
         
    end 
        
        outage_counter = (counterval('outage_counter'))  
end 
 
 outage_percentage = (( counterval('outage_counter') /mobiles)*100) 
  
% plot(mobiles, outage_percentage); 
 %title('Outage Probability vs Number of Mobiles - Distance Based Power Control Algorithm') 
 %xlabel('Number of mobiles in cell') 
 %ylabel('Percentage of mobiles in outage') 
  
end