% Radiation Pattern for N-Element Adaptive Array
% with Multiple Narrow-Band Noise Jammers
%-----------------------------------------------
% adap_apple2.m
clear;clc;
%Adaptive Array Parameters (default values)
nx= 3; % Number of Noise Jammers
n=8; % Number of Array Elements
thetas =0; %Target Angle - deg
d=.1; % Noise Power / Jammer Power
% Use a dialog box to get input
header= 'Adaptive Array Parameters';
prompt = {'Number Noise Jammers', 'Number Array Elements',...
'Target Angle - deg', 'Noise / Jam Ratio'};
default = {num2str(nx), num2str(n), num2str(thetas),...
num2str(d)};
response = inputdlg(prompt, header, 1, default);
fields = {'nx', 'n', 'thetas','d'};
input = cell2struct(response,fields,1);
% Convert cell structure created by dialog box back to numbers
nx = str2num(input.nx);
n = str2num(input.n);
thetas = str2num(input.thetas);
d = str2num(input.d);
if nx>n-1;
error('Array Exceeds Degree of Freedom');
end;
beam_wid_rad=2*asin(2/n);
beam_wid=180*beam_wid_rad/pi;
for loop = 1:nx;
if loop<=2;
thetaj(loop)=30+15*(loop-1);
else
thetaj(loop)=-30-15*(loop-3);
end;
ax(loop)=1;
header = ['Standoff Jammer #' num2str(loop)];
prompt = {'Jammer Angle (deg)', 'Relative Jam Power'};
default = {num2str(thetaj(loop)),num2str(ax(loop))};
response = inputdlg(prompt, header, 1, default);
fields = {'thetaj','ax'};
input = cell2struct(response,fields,1);
%Convert cell structure created by dialog box back to numbers
thetaj(loop) = str2num(input.thetaj);
if abs(thetaj(loop))<beam_wid/2+3;
error('Jammer Angle in Main Array Beam')
end;
ax(loop) = str2num(input.ax);
end;
for i=1:nx;
thetaj(i)= thetaj(i)*pi/180; % Jam Angle - rad
psinj(i)=pi*sin(thetaj(i)); % Jam Angle - sin space
end;
% Array Angle
theta= -90:.1:90; % Pattern Angle - deg
thetar= pi*theta/180; % Pattern Angle - rad
% Weight Calculation
% Covariance Matrix using Applebaum's Transformation
I=ones(n);
Z=zeros(n);
for i=1:nx;
for k=1:n;
Z(k,k)=exp(j*(k-1)*psinj(i));
end;
Rx=ax(i)*conj(Z)*I*Z;
if i==1;R=Rx;
else R=Rx+R;end; % Jammer Covariance Matrix
end;
pj=sum(ax); % Total Jam Power
R=R/pj+d*eye(n); % Sum of Jammer + Noise Covariance Matrix
% Signal
thetas=pi*thetas/180; % Signal Angle - rad
psins=pi*sin(thetas); % Signal Angle Sin Space
S=ones(n,1);
%S=[1;1]; % Steering Vector
w=d*inv(R)*S; % Weight Vector
Ms=S*S'; % Signal Covariance Matrix
Ps=w'*Ms*conj(w); % Signal Power
fac=sqrt(Ps); % Normalize Factor for Ps=1
wn=w/fac % Normalized Weights
% Array Output
for i=1:1801;
psi(i) = pi*sin(thetar(i)); % Array Angle in Sin Space
for k=1:n;
A(1,k)=exp(j*(k-1)*(psi(i)-psins));
end;
v(i)=abs(sum(A*w/fac)); % Array Voltage Pattern
end;
p= v.^2; % Array Power Out Pattern
figure(1);
plot(theta,p);grid;
xlabel('Degrees');
ylabel('Amplitude');
title(['Antenna Pattern ',num2str(n),'-Element Adaptive Array']);
axis([-60,60,0,1]);
hold on
% Grid Lines x=-60 to 60, space=5;y=0-1;space=.05
xl=-60;xh=60;yl=0;yh=1;nx=25;ny=21;
hx=gridline(xl,xh,nx,yl,yh,ny);
hold off
figure(2)
p_db=10*log10(p);
plot(theta,p_db);grid;
xlabel('Degrees');
ylabel('Amplitude - dB');
title(['Antenna Pattern ',num2str(n),'-Element Adaptive Array']);
axis([-60,60,-50,0]);
评论0