www.pudn.com > smamt.zip > gESmart.m, change:2006-07-18,size:4095b


%------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------% 
%                               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 ( ESPRIT ) , 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' ) ; 
%ESPRIT Algorithm Estimation 
VV = V ( : , [ 3 4 ] ) ; 
VV1 = VV ( [ 1 2 3 ] , : ) ; 
VV2 = VV ( [ 2 3 4 ] , : ) ; 
Cv = [ VV1' ; VV2' ] * [ VV1  VV2 ] ; 
[ Vc , Ec ] = eig ( Cv , 'nobalance' ) ; 
G1 = Vc ( [ 1 2 ] , [ 3 4 ] ) ; 
G2 = Vc ( [ 3 4 ] , [ 3 4 ] ) ; 
Lg = -G1 * inv ( G2 ) ; 
Eg = eig ( Lg ) ; 
G  = asin ( angle ( Eg ) / pi) ; 
%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 - 2  ; 
    UU =  J  ; 
    UUU = J + 2 ; 
    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