MATLAB Examples

Beamforming Resolution Demo for an Uniform Linear Array (ULA).

In this example, the number of elements varies while the element spacing is always $\lambda/2$.

Copyright 2017 - 2027, Ilias S. Konsoulas.

Contents

Workspace Initialization.

clc; clear; close all;

Attay Geometric Characteristics.

lambda = 1;      % Incoming Signal Wavelength in (m).
M = [32 16 8 4]; % Number of Array Elements.
d = lambda/2;    % Element Spacing.
phi_s = 0;
N_fft = 2*512;
C1 = zeros(length(M),N_fft);

% Define the angle grid.
angle = -90:180/N_fft:90-1/N_fft;  % Create N_fft angle samples between -90 to 90 deg.
% angle = -180:360/N_fft:180-1/N_fft;  % Create N_fft angle samples between -180 to 180 deg.

for m=1:length(M)
    u_s = (d/lambda)*sin(phi_s*pi/180);
    c_mf = exp(-1i*2*pi*u_s*(0:M(m)-1).')/sqrt(M(m));
    for k=1:N_fft
        u = (d/lambda)*sin(angle(k)*pi/180);
        v = exp(-1i*2*pi*u*(0:M(m)-1)')/sqrt(M(m)); % Azimuth Scanning Steering Vector.
        C1(m,k)= c_mf'*v;
    end
end

Plot the Beampatterns in Cartesian.

figure('NumberTitle','off','Name','Figure 11.12a','Position',[0 0 1000 950]);

subplot(2,2,1);
plot(angle,10*log10(abs(C1(1,:)).^2),'b')
title('M = 32');
xlabel('Angle (deg)');
ylabel('Power (dB)');
xlim([-90 90]);
ylim([-40 5]);
grid on;

subplot(2,2,2);
plot(angle,10*log10(abs(C1(2,:)).^2),'r')
title('M = 16');
xlabel('Angle (deg)');
ylabel('Power (dB)');
xlim([-90 90]);
ylim([-40 5]);
grid on;

subplot(2,2,3);
plot(angle,10*log10(abs(C1(3,:)).^2),'g')
title('M = 8');
xlabel('Angle (deg)');
ylabel('Power (dB)');
xlim([-90 90]);
ylim([-40 5]);
grid on;

subplot(2,2,4);
plot(angle,10*log10(abs(C1(4,:)).^2),'m')
title('M = 4');
xlabel('Angle (deg)');
ylabel('Power (dB)');
xlim([-90 90]);
ylim([-40 5]);
grid on;
tightfig;

Plot in Polar Coordinates

figure('NumberTitle','off','Name','Figure 11.12b-Polar','Position',[0 0 1000 950]);

subplot(2,2,1);
polardb(angle*pi/180,10*log10(abs(C1(1,:)).^2),-60,'b');
title('M = 32');
grid on;

subplot(2,2,2);
polardb(angle*pi/180,10*log10(abs(C1(2,:)).^2),-60,'r');
title('M = 16');
grid on;

subplot(2,2,3);
polardb(angle*pi/180,10*log10(abs(C1(3,:)).^2),-60,'g');
title('M = 8');
grid on;

subplot(2,2,4);
polardb(angle*pi/180,10*log10(abs(C1(4,:)).^2),-60,'m');
title('M = 4');
grid on;
tightfig;