www.pudn.com > smamt.zip > SMSmart.m, change:2006-07-22,size:4810b


%------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------% 
%                               This Program is Designed To Simulate The Smart Antenna System  On A BTS Receiver ( Uplink )                                % 
%                                                             General Constraints For Using This Software                                                                                                     % 
%Antenna Array Of Four Elements Operating On 2 GHz With A Separation Distance 0.075 Meters                                                                % 
%Narrowband ( Uncorrelated Or Partially Correlated ) Signals Are Assumed                                                                                                         % 
%An Authentication Code Of 10 Bits Is Sent First                                                                                                                                                               % 
%Two Users Are Served Only In The Presence Of Additive White Gaussian Noise Only                                                                                      %  
%Operation Is Subdivided Into Three Stages : Angle Of Arrival Estimation ( MUSIC ) , Adaptive Beamforming , Signal Regeneration  % 
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------% 
%Input Received Signals Arrival 
P = input ('The Channel Signal To Noise Ratio : ') ; 
for I = 1 : 2 
    A ( I ) = input ('The Signal Arrival Phase Angle : ') ; 
    A ( I ) = A ( I ) * pi / 180 ; 
end 
H = randint ( 2 , 10 ) ; 
%Estimation of The Covariance Matrix 
S = zeros ( 4 , 2 ) ; 
R = zeros ( 4 , 4 ) ; 
ZZ = zeros ( 4 , 10 ) ; 
for K = 1 : 10 
    for J = 1 : 2 
        for I = 1 : 4 
            S ( I , J ) = exp ( i*( pi  * ( I - 1 ) * cos ( A ( J ) ) ) )  ;   
        end 
    end 
    S = awgn ( S * H ( : , K ) , P ) ; 
    ZZ ( : , K ) = S ; 
    R = R + S * S' ; 
end 
R = R / 10 ; 
[ V , E ] = eig ( R , 'nobalance' ) ; 
%MUSIC Algorithm Estimation 
for J = 1 : 4 
    for I = 1 : 2  
        VV ( J , I ) = V ( J , I ) ; 
    end 
end 
I = 1 ; 
F = zeros ( 1 , 629 ) ; 
for T = 0 : 0.005 : pi  
    K = 0 : 3 ; 
    B = exp ( j .* K * pi * cos ( T ) ) ; 
    C = B.' ; 
    F ( I ) = ( C' * C ) / ( C' * VV * VV' * C ) ; 
    I = I + 1 ; 
end 
%Plot of The MUSIC Angular Pseudo Spectrum 
T = 0 : 0.005 : pi ; 
T = ( T * 180 ) / pi ; 
FF = 10 * log10 ( abs ( F ) / max ( abs ( F ) ) ) ; 
figure ( 1 ) , plot ( T , FF ) , xlabel ('The Phase Angle In Degrees') , ylabel ('The Angular Pseudo Spectrum') , title ('The Spatial MUSIC Spectrum') , grid on ; 
%Estimation The Angle of Arrival For The Received Signals 
for I = 1 : 629 
    if FF ( I ) == 0 FF ( I ) = 1000 ; 
    end 
end 
FF = imregionalmax ( FF ) .* FF ; 
for I = 1 : 629 
    if FF ( I ) == 0 FF ( I ) = -1000 ; 
    end 
end 
for I = 1 : 2 
    Y = max ( FF ) ; 
    for J = 1 : 629 
      if Y == FF ( J )  ; 
         G ( I ) = ( T ( J ) * pi ) / 180 ; 
         FF ( J ) = -1000 ; 
      end 
    end 
end 
%Estimation The Weight Vector of A Null Steering Beamformer 
for I = 1 : 2 
   for J = 1 : 4 
       SS ( I , J ) = exp ( i*( pi * ( J-1 ) * cos ( G ( I ) ))) ; 
  end 
end 
B = eye ( 2 ) ; 
for J = 3 : 4 
    Z = B ( J-2  , : ) ; 
    W = SS \ Z' ; 
    MM = 0 ; 
    %Plot of The Output Radiation Pattern And The Output Valid Digital Data of The Null Steering Beamformer 
    TT = 0 : 0.005 : pi ; 
    for I = 1 : 4 
       HH = exp ( i*( pi * ( I-1 )*cos ( TT ))) ; 
       MM = MM + ( HH * W(I) ) ; 
    end 
    TT = ( TT * 180 ) / pi ; 
    MM = 20 * log10 ( abs ( MM )/ max ( abs ( MM ) ) ) ; 
    for K = 1 : 10 
       OO ( K ) = W.' * ZZ ( : , K ) ; 
    end 
    OO = abs ( OO / max ( OO )) ; 
    OO ( 11 ) = 0 ; 
    U = J - 1  ; 
    UU = J + 1 ; 
    UUU = J + 3 ; 
    figure ( U ) , plot ( TT , MM ) , xlabel ('Phase Angle In Degrees') , ylabel ('Electric Field In dB') , title ( 'A Choice Radiation Pattern Of A Spatial Beamformer') ,  axis ( [ 0 180 -10 0 ] ) , grid on ;      
    figure ( UU ) , stairs ( OO , 'linewidth' , 2 ) , title ('A Choice Output Digital Data') ,  xlabel ('The Bit Transition Period') , ylabel  ('The Output Digital Signal') , grid on ; 
    %Comparator Operation 
    for I = 1 : 10 
        if OO ( I ) > 0.5 OO ( I ) = 1 ; 
        else OO ( I ) = 0 ; 
        end 
    end 
    figure ( UUU ) , stairs ( OO , 'linewidth' , 2 ) , title ('The Output Valid Digital Data') ,  xlabel ('The Bit Transition Period') , ylabel  ('The Output Digital Signal') , grid on ; 
end