%%---------------beampattern of the phased array--------------------
%%-----------------2023.5.6 Xidian University----------------------
clc; clear all; close all;
% ========================================================================
% parameter setting
% ========================================================================
j = sqrt(-1);
N=10;
c = 3e8;
f0=3e8;
lambda0=c/f0;
d=lambda0/2;
theta_s=0;
% ========================================================================
% data
% ========================================================================
w_non=exp(j*2*pi/lambda0*(0:N-1)'*d*sind(theta_k)); % non-dapvtive weight vector
% ========================================================================
% beamforming
% ========================================================================
theta = (-90:1:90); % scope of the angle
AF = zeros(1,length(theta)); % non-adaptive beampattern (data-independent)
for i = 1:length(theta)
a= exp(j*2*pi/lambda0*(0:N-1)'*d*sind(theta(i)));
AF(i) = w'*a;
end
% ========================================================================
% plot figure
% ========================================================================
AF= 20*log10(abs(AF)/(max((abs(AF)))));
disp_dB = -60;
for i = 1 : length(theta)
if (AF(i) < disp_dB); AF(i) = disp_dB; end
end
plot(theta,AF); % 绘制方向图
axis tight; axis xy;
grid on; hold on;
xlabel('angle(degree)'); ylabel('Normalized voltage amplitude(dB)');
title('non-adaptive beampattern');