www.gusucode.com > phased 案例源码 matlab代码程序 > phased/CompareTriangularRectangularLatticeURAExample.m

    %% Compare Triangular and Rectangular Lattice URA's
% This example shows how to find and plot the positions of the
% elements of a 5-row-by-6-column URA with a triangular lattice
% and a URA with a rectangular lattice. The element spacing is
% 0.5 meters for both lattices.

% Copyright 2015 The MathWorks, Inc.


%%
% Create the arrays.
h_tri = phased.URA('Size',[5 6],'Lattice','Triangular');
h_rec = phased.URA('Size',[5 6],'Lattice','Rectangular');

%%
% Get the element y,z positions for each array.
% All the x coordinates are zero.

pos_tri = getElementPosition(h_tri);
pos_rec = getElementPosition(h_rec);
pos_yz_tri = pos_tri(2:3,:);
pos_yz_rec = pos_rec(2:3,:);

%%
% Plot the element positions in the yz-plane.
figure;
gcf.Position = [100 100 300 400];
subplot(2,1,1);
plot(pos_yz_tri(1,:), pos_yz_tri(2,:), '.')
axis([-1.5 1.5 -2 2])
xlabel('y'); ylabel('z')
title('Triangular Lattice')
subplot(2,1,2);
plot(pos_yz_rec(1,:), pos_yz_rec(2,:), '.')
axis([-1.5 1.5 -2 2])
xlabel('y'); ylabel('z')
title('Rectangular Lattice')