Followings are the code that I wrote in Matlab Phased Array System Toolbox to creates all the plots shown in this page. You may copy these code and play with these codes. Change variables and try yourself until you get your own intuitive understanding.
< Code 1 >
c = 3e8; % propagation speed
fc = 26e9; % carrier frequency
lambda = c/fc; % wavelength
NoOfTxAntenna = 4;
d_scale = 1.40;
txarray = phased.ULA('NumElements',NoOfTxAntenna,'ElementSpacing',d_scale*lambda/2);
txarray.Element.BackBaffled = true;
steer_ang = [0;0];
stv = phased.SteeringVector('SensorArray',txarray);
w = stv(fc,steer_ang);
hFig = figure(1);
set(hFig,'Position',[300 100 800 600]);
set(gcf,'color','w');
subplot(2,2,1);
pattern(txarray,fc,[-180:180],[-90:90],...
'PropagationSpeed',c,...
'CoordinateSystem','polar',...
'Type','powerdb', ...
'Weights',w)
view(90,20);
sTitle = sprintf("Antenna Array = %d by %d\nSteering Angle=[%d %d]\nd = %0.2f half wavelength",...
NoOfTxAntenna,1,steer_ang(1),steer_ang(2),d_scale);
title(sTitle,'FontWeight','normal');
set(gca,'fontsize',8);
subplot(2,2,2);
hold on;
i = 1;
for y = 4:4
for x = 3:6
circle(x,y,0.5);
vx1 = x;
vy1 = y;
vx2 = x + 0.5*real(w(i));
vy2 = y + 0.5*imag(w(i));
line([vx1 vx2],[vy1 vy2],'Color','red');
plot(vx2,vy2,'ro','MarkerFaceColor',[1 0 0],'MarkerSize',3);
i = i + 1;
end
end
axis([0 9 -0.5 8.5]);
title('Steering Weight','FontWeight','normal');
set(gca,'xticklabel',[]);set(gca,'yticklabel',[]);
set(gca,'xtick',[]);set(gca,'ytick',[]);
set(gca,'fontsize',8);
daspect([1 1 1]);
box on;
hold off;
subplot(2,2,3);
[pat,azimuth,elevation] = pattern(txarray,fc,0,[-90:90],...
'PropagationSpeed',c,...
'CoordinateSystem','polar',...
'Type','directivity', ...
'Weights',w ...
);
polarplot(elevation*pi/180,pat,'r-');
rlim([-40 30]);
rticks([-40 -20 0 10 20 30]);
title('Directivity(dBi)[Elevation @ Azimuth = 0]','FontWeight','normal');
set(gca,'fontsize',8);
subplot(2,2,4);
[pat,azimuth,elevation] = pattern(txarray,fc,[-180:180],0,...
'PropagationSpeed',c,...
'CoordinateSystem','polar',...
'Type','directivity', ...
'Weights',w);
pat(isinf(pat)|isnan(pat)) = -40;
pat(pat<=-40) = -40;
polarplot(azimuth*pi/180,pat,'r-');
rlim([-40 30]);
rticks([-40 -20 0 10 20 30]);
title('Directivity(dBi)[Azimuth @ Elevation = 0]','FontWeight','normal');
set(gca,'fontsize',8);
function circle(x,y,r)
t = linspace(0,2*pi,20);
plot(x+r*cos(t),y+r*sin(t),'k-');
end
|