📄 smart_antennab.m
字号:
%Author: Mohamed Shaban
% Summary: A Spatial Beamformer Based On The MUSIC And Null Steering Principles
% MATLAB Release: R14
% Description: This Program Is Designed To Simulate A Spatial Antenna Array
% System Working On The MUSIC Algorithm For The Angle Of Arrival Estimation
% And Null Steering Algorithm For The Weights Estimation To The Required
% Output Radiation Pattern .
% It Represents The Pseudo Spectrum Of The MUSIC Algorithm , The Output
% Radiation Pattern Of The Beamformer , The Input Transmitted Digital Data
% And The Output Received Spatially Filtered Digital Data .
% Try It ... Rate Me
% Smart Antenna Project
% Mansoura University
%This Program is Designed To Simulate The Operation and Performance Of A Spatial Reference Beamformer Based On The MUSIC Algorithm Assuming Through A Certain Traffic Channel Assigned By A Certain Multiple Access Scheme , Number Of Communicating Users is Less Than Number Of Elements
D = input ('Number Of Elements : ') ;
N = input ('Number Of Users : ') ;
Q = input ('The User To Be Selected At A Cetain Receiver : ') ;
L = input ('Number Of Samples : ') ;
P = input ('Signal To Noise Ratio Per Sample : ') ;
for I = 1 : N
A ( I ) = input ('The Signal Arrival Phase Angle : ') ;
A ( I ) = A ( I ) * pi / 180 ;
end
H = randint ( N , L ) ;
DD = H ( Q , : ) ;
DD ( L + 1 ) = 0 ;
figure ( 1 ) , stairs( DD , 'linewidth' , 2 ) , title ('The Input Transmitted Digital Data') , xlabel ('The Bit Transition Period') , ylabel ('The Input Digital Signal') , grid on ;
S = zeros ( D , N ) ;
R = zeros ( D , D ) ;
ZZ = zeros ( D , L ) ;
for K = 1 : L
for J = 1 : N
for I = 1 : D
S ( I , J ) = exp ( i*( pi / 2 * ( I - 1 ) * cos ( A ( J ) ) ) ) ;
end
end
S = awgn ( S * H ( : , K ) , P ) ;
ZZ ( : , K ) = S ;
R = R + S * S' ;
end
R = R / D ;
[ V , E ] = eig ( R , 'nobalance' ) ;
for J = 1 : D
for I = 1 : D - N
VV ( J , I ) = V ( J , I ) ;
end
end
I = 1 ;
F = zeros ( 1 , 629 ) ;
for T = 0 : 0.005 : pi
K = 0 : D-1 ;
B = exp ( j .* K * pi / 2 * cos ( T ) ) ;
C = B.' ;
F ( I ) = ( C' * C ) / ( C' * VV * VV' * C ) ;
I = I + 1 ;
end
T = 0 : 0.005 : pi ;
T = ( T * 180 ) / pi ;
F = 10 * log10 ( abs ( F ) / max ( F ) ) ;
figure ( 2 ) , plot ( T , F ) , xlabel ('The Phase Angle In Degrees') , ylabel ('The Angular Pseudo Spectrum') , title ('The Spatial MUSIC Spectrum') , grid on ;
for I = 1 : N
Y = max ( F ) ;
for J = 1 : 629
if Y == F ( J )
V ( I ) = ( J * 0.005 ) ;
F ( J ) = min ( F ) ;
end
end
end
for I = 1 : N
for J = 1 : D
SS ( I , J ) = exp ( i*( pi / 2 * ( J-1 ) * cos ( V ( I ) ))) ;
end
end
Z = eye ( N ) ;
Z = Z ( Q , : ) ;
W = SS \ Z' ;
MM = 0 ;
TT = 0 : 0.005 : pi ;
for I = 1 : D
HH = exp ( i*( pi / 2 * ( I-1 )*cos ( TT ))) ;
MM = MM + ( HH * W(I) ) ;
end
TT = ( TT * 180 ) / pi ;
MM = 20 * log10 ( abs ( MM )/ max ( abs ( MM ) ) ) ;
figure ( 3 ) , plot ( TT , MM ) , xlabel ('Phase Angle In Degrees') , ylabel ('Electric Field In dB'), title ( 'The Output Radiation Pattern Of A Spatial Beamformer') , axis ( [ 0 180 -10 0 ] ) , grid on ;
for J = 1 : L
OO ( J ) = W.' * ZZ ( : , J ) ;
end
OO = abs ( OO / max ( OO )) ;
OO ( L + 1 ) = 0 ;
figure ( 4 ) , stairs ( OO , 'linewidth' , 2 ) , title ('The Output Valid Digital Data') , xlabel ('The Bit Transition Period') , ylabel ('The Output Digital Signal') , grid on ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -