MATLAB Answers

# Why is the radiation pattern does not show the required steering angle?

2 views (last 30 days)
ZIYI WENG on 7 May 2021
Commented: ZIYI WENG on 10 May 2021
N = 16;%number of elements
wl = 1;%wavelength
k = 2.*pi./wl;
d = wl./2;%distance
f = zeros(1,180);%empty array for field
AF = zeros(1,100);%empty array for complec weights
thi = -45;%The scan angle
angle_radi = thi.*pi./180;%angle to radian
phi= (2.*pi.*d .*sin(angle_radi))./wl;%equation for phase shift
for a = 1:N %for loop to repeat until the Nth phase shift
AF(a)= (a-1).*phi;%First number = (1-1)*phi
while AF(a) > 2*pi
AF(a) = AF(a) - 2.*pi;
if AF(a)<= 2*pi;break;end
end %minimize the data if it is larger than 2pi
while AF(a) < -2*pi
AF(a) =AF(a) + 2*pi;
if AF(a) >= -2*pi;break;end
end %maximize the data if it is smaller than -2pi
end%does not affect the result but mitigate the calculation
as = AF(2)+AF(3)+AF(4)+AF(5)+AF(6)+AF(7)+AF(8)+AF(9);%weights in total
for th =1:360 %angle from 1 to 360
s = 0
angle_1rad(th) = th.*pi/180;%angle to radian
for i = 1:N
s = s + exp((-1j).*k.*(i-1).*d.*sin(angle_1rad(th))+as)%equation for field
end
f(th)= abs(s);
end
M = max(f);
z = f./M;%normalize the data
figure
polarplot(angle_1rad+as,z);
%title('linear polar plot');
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

David Goodmanson on 8 May 2021
Edited: David Goodmanson on 8 May 2021
Hi ZW,
In the code below, the key line is
s = s + exp((-1j*k*d*(i-1).*sin(angle_1rad(th))) +1j*AF(i)); %equation for field
which is simply the sum of N phase angles due to propagation at the given angle, each multplied by the phase angle AF required to aim the beam at -45 degrees. I don't know the intent of the sum as = AF(2) + ...AF(9), but it is not necessary. I left out the while loops changing the values of angles by multiples of 2pi since it is unnecessary for accuracy (unless the number of antenna elements gets into maybe millions).
The polar plot shows a peak at -45 degrees and an equal peak at -135 degrees. With your geometry the line of emitters is the plus and minus vertical y axis, 90 degrees and 270 degrees, so there is equal emission on each side of the antenna as required.
The second code shortens things up by replacing some of the for loops with the vectorized version. (the code also uses exp(+1j*k*x)-type wave propagation rather than exp(-1j*k*x), since the former seems more intuitive).
N = 16; % number of elements
wl = 1; % wavelength
k = 2.*pi./wl;
d = wl./2; % distance
f = zeros(1,360); % empty array for field
AF = zeros(1,100); % empty array for complec weights
thi = -45; % The scan angle
angle_radi = thi.*pi./180; % angle to radian
phi= (k.*d .*sin(angle_radi)); % eqn for phase shift [in terms of k]
for a = 1:N %for loop to repeat until the Nth phase shift
AF(a)= (a-1).*phi; % First number = (1-1)*phi
end
%as = AF(2)+AF(3)+AF(4)+AF(5)+AF(6)+AF(7)+AF(8)+AF(9);%weights in total
for th =1:360 %angle from 1 to 360
s = 0;
angle_1rad(th) = th.*pi/180; % angle to radian
for i = 1:N
s = s + exp((-1j*k*d*(i-1).*sin(angle_1rad(th)))+1j*AF(i)); %equation for field
end
f(th)= abs(s);
end
%
M = max(f);
z = f./M;%normalize the data
figure(1)
polarplot(angle_1rad,z);
title('linear polar plot');
N = 16; % number of elements
wl = 1; % wavelength
k = 2*pi/wl;
d = wl/2; % distance
thi = -45; % The scan angle
thirad = thi.*pi./180; % angle to radian
f = zeros(1,360);
anglerad = zeros(1,360);
phi= (k*d*sin(thirad)); % eqn for phase shift [in terms of k]
AF = (0:N-1)*phi;
for th =1:360 % angle from 1 to 360
anglerad(th) = th.*pi/180; % angle to radian
thvecN = k*d*(0:N-1)*sin(anglerad(th)); % phase angles due to propagation
s = sum(exp(1j*(thvecN-AF)));
f(th)= abs(s);
end
z = f/max(f); % normalize the data
figure(2)
polarplot(anglerad,z);
title('linear polar plot');
##### 1 CommentShowHide None
ZIYI WENG on 10 May 2021
Thank you very much. I found a different way to solve it later that day, but thanks anyway. I will try your code and see what will happen.

Sign in to comment.

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!