this code shows beam steering by phase in the antenna array. By varying the progressive phase shift p across the 8 elements, the code demonstrates electronic beam steering while maintaining the beam shape. The phase controls the steering angle.
-
Key Aspects:
-
Parameters:
-
n = 8 elements
-
d = spacing between elements
-
p = progressive phase shift
-
Varying p steers the beam direction
-
Keeps main lobe width and sidelobes fixed
-
Plots:
< Code 1 >
theta = -1.0*pi:pi/100:1.0*pi;
phaseShift = exp(-j*2*pi/8);
pn = 20;
p = pn*pi/20;
d = 2.0;
a_theta = [exp(-j .* 0 .* d .* sin(theta-p)) ;
exp(-j .* 1 .* d .* sin(theta-p));
exp(-j .* 2 .* d .* sin(theta-p));
exp(-j .* 3 .* d .* sin(theta-p));
exp(-j .* 4 .* d .* sin(theta-p));
exp(-j .* 5 .* d .* sin(theta-p));
exp(-j .* 6 .* d .* sin(theta-p));
exp(-j .* 7 .* d .* sin(theta-p))];
n = 8;
a_theta = a_theta([1:n],:);
a_theta_sum = sum(a_theta);
%s_theta_sum = sum(s_theta);
a_theta_sum_abs = abs(a_theta_sum);
a_theta_sum_abs = a_theta_sum_abs ./ max(a_theta_sum_abs);
a_theta_sum_abs_dB = 10 .* log(a_theta_sum_abs);
for i = 1:length(a_theta_sum_abs_dB)
if a_theta_sum_abs_dB(i) <= -30
a_theta_sum_abs_dB(i) = -30;
end;
end;
a_theta_sum_abs_dB = a_theta_sum_abs_dB - min(a_theta_sum_abs_dB);
if max(a_theta_sum_abs_dB) != 0
a_theta_sum_abs_dB = a_theta_sum_abs_dB/max(a_theta_sum_abs_dB);
end;
hFig = figure(1,'Position',[300 300 700 600]);
subplot(2,5,[1 2]);
plot(theta,a_theta_sum_abs);
xlim([-pi pi]);
ylim([0 1]);
tStr = sprintf("d = %0.2f, p = %d pi/20",d,pn);
title(tStr);
set(gca,'xtick',[-pi -(3/4)*pi -pi/2 -pi/4 0 pi/4 pi/2 (3/4)*pi pi]);
set(gca,'xticklabel',{'-pi','-3pi/4','-pi/2' '-pi/4' '0' 'pi/4' 'pi/2','-3pi/4','pi'});
subplot(2,5,[4 5]);
polar(theta,a_theta_sum_abs,'-r');
t = findall(gcf,'type','text');
%delete(t);
subplot(2,5,[6 7]);plot(theta,10 .* log(a_theta_sum_abs));ylim([-30 1]);
xlim([-pi pi]);
tStr = sprintf("d = %0.2f, p = %d pi/20",d,pn);
title(tStr);
set(gca,'xtick',[-pi -(3/4)*pi -pi/2 -pi/4 0 pi/4 pi/2 (3/4)*pi pi]);
set(gca,'xticklabel',{'-pi','-3pi/4','-pi/2' '-pi/4' '0' 'pi/4' 'pi/2','-3pi/4','pi'});
subplot(2,5,[9 10]);
polar(theta,a_theta_sum_abs_dB,'-r');
t = findall(gcf,'type','text');
|