<jupyter_start><jupyter_text>***Introduction to Radar Using Python and MATLAB*** <NAME> - Copyright (C) 2019 Artech House Circular Array Antenna*** The circular array is shown in Figure 3.22.  For this type of array, the radiating elements are placed on a circular path with spacing of $a \, \Delta\phi$, where $a$ is the radius, and $\Delta\phi$ is the angular difference between the elements.  The normalized electric field is written as$$	E(r, \theta, \phi) = \sum\limits_{n=1}^{N}a_n\, \frac{e^{-j k r_n}}{r_n} \hspace{0.5in} \text{(V/m)},$$where$$	r_n = \sqrt{r^2 + a^2 - 2\, a\, r\, \cos \psi_n} \hspace{0.5in} \text{(m)}.$$For phase terms, $r_n$ is approximated by$$	r_n \approx r - a\, \sin\theta\, \cos(\phi - \phi_n) \hspace{0.5in} \text{(m)},$$where $\phi_n$ is the angular position of the $n$th element, and is expressed as\begin{equation}	\phi_n = \frac{2\pi\, n}{N} \hspace{0.5in} \text{(rad)},\end{equation}and for amplitude $r_n \approx r$.  The coefficients, $a_n$, are represented by an amplitude and phase as$$	a_n = A_n\, e^{j \alpha_n},$$where $A_n$ is the amplitude and $\alpha_n$ is the phase.  The array factor for the circular array is now written as$$	{AF}(\theta, \phi) = \sum\limits_{n=1}^{N}A_n\, e^{j [k a \sin\theta\, \cos(\phi-\phi_n) + \alpha_n]} .$$*** Begin by getting the library path<jupyter_code>import lib_path<jupyter_output><empty_output><jupyter_text>Set the operating frequency (Hz), the number of elements, the scan angle (theta - degrees), (phi - degrees), and the radius (m)<jupyter_code>frequency = 300e6

number_of_elements = 40.0

scan_angle_theta = 30.0

scan_angle_phi = 30.0

radius = 1.1<jupyter_output><empty_output><jupyter_text>Set up the theta and phi arrays using the `meshgrid` and `linspace` routines from `scipy`<jupyter_code>from numpy import linspace, meshgrid, radians

from scipy.constants import pi


n = 360

m = int(n / 8)

theta, phi = meshgrid(linspace(0.0 * pi, 0.5 * pi, n), linspace(0.0, 2.0 * pi, n))<jupyter_output><empty_output><jupyter_text>Set up the keyword args<jupyter_code>kwargs = {'number_of_elements': number_of_elements,

          'scan_angle_theta': radians(scan_angle_theta),

          'scan_angle_phi': radians(scan_angle_phi),

          'radius': radius,

          'frequency': frequency,

          'theta': theta,

          'phi': phi}<jupyter_output><empty_output><jupyter_text>Calculate the array factor using the `circular_uniform` routines<jupyter_code>from Libs.antenna.array import circular_uniform

af = circular_uniform.array_factor(**kwargs)<jupyter_output><empty_output><jupyter_text>Create the U-V coordinates for displaying the antenna pattern<jupyter_code>from numpy import sin, cos

uu = sin(theta) * cos(phi)

vv = sin(theta) * sin(phi)<jupyter_output><empty_output><jupyter_text>Create the color plot of the array factor using the `matplotlib` routines<jupyter_code>from matplotlib import pyplot as plt


# Set the figure size

plt.rcParams["figure.figsize"] = (15, 10)


# Set up the axes

fig, axes1 = plt.subplots()



im = axes1.pcolor(uu, vv, abs(af), cmap="jet", shading = 'auto')

cbar = fig.colorbar(im, ax=axes1, orientation='vertical')

cbar.set_label("Normalized Electric Field (V/m)", size=10)



# Set the x- and y-axis labels

axes1.set_xlabel("U (sines)", size=12)

axes1.set_ylabel("V (sines)", size=12)


# Set the plot title

plt.title('Circular Array - Array Factor', size=14)<jupyter_output><empty_output><jupyter_text>Create the contour plot using the `matplotlib` routines<jupyter_code># Set the figure size

plt.rcParams["figure.figsize"] = (12, 12)

plt.contour(uu, vv, abs(af), 20, cmap="jet", vmin=-0.2, vmax=1.0)

plt.grid(linestyle=':', linewidth=0.5)


# Set the x- and y-axis labels

plt.xlabel("U (sines)", size=12)

plt.ylabel("V (sines)", size=12)


# Set the plot title

plt.title('Circular Array - Array Factor', size=14)<jupyter_output><empty_output><jupyter_text>Create the line plot using the `matplotlib` routines<jupyter_code>from numpy import degrees, log10


plt.plot(degrees(theta[0]), 20.0 * log10(abs(af[m])), '', label='E Plane')

plt.plot(degrees(theta[0]), 20.0 * log10(abs(af[0])), '--', label='H Plane')



# Set the y axis limit

plt.ylim(-60, 5)



# Set the x and y axis labels

plt.xlabel("Theta (degrees)", size=12)

plt.ylabel("Array Factor (dB)", size=12)



# Turn on the grid

plt.grid(linestyle=':', linewidth=0.5)



# Place the legend

plt.legend(loc='upper right', prop={'size': 10})



# Set the plot title

plt.title('Circular Array - Array Factor', size=14)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1513359614542269, 'fraction_numerical': 0.02431011826544021, 'mean_word_length': 4.810432569974555, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '488408', 'license': 'Apache-2.0', 'n_tokens_mistral': 1779, 'n_tokens_neox': 1651, 'n_words': 462, 'path': 'jupyter/Chapter03/circular_array.ipynb', 'repo_name': 'mberkanbicer/software', 'size': '4573'}