#### minuscat

##### Newbie level 1

**Gain pattern**

I want to draw the gain pattern of uniform linear array and uniform circular array. But I don't know how to normalize electrical field into antenna gain.

Here is my MATLAB code in UCA.

E0 = 1;

theta_0 = 90/180*pi;

phi_0 = 0/180*pi;

N = 8;

lambda = 1;

d = lambda/2;

a = d*(N/2/pi);

k = 2*pi/lambda;

phi = 0.01:0.01:2*pi;

theta = 0.01:0.01i;

E = zeros(length(theta),length(phi));

for it = 1:1:length(theta)

for it2 = 1:1:length(phi)

for it3 = 1:1:N

alfa = -k*a*sin(theta_0)*cos(phi_0-2*pi*it3/N);

E(it,it2) = E(it,it2) + E0*exp(j*k*a*sin(theta(it))*cos(phi(it2)-2*pi*it3/N)

+ j*alfa);

end

end

end

G = E(157,: );

F = abs(G).^2;

figure

polar(phi,F,'-b');

I use the electrical field formula from the book, but I don't really know how to normalize it into gain pattern.