I am currently carrying out a project on antenna group theory. I started developing the theory on shaped patterns from a continuous planar aperture distribution. The next step was to develop this theory on a discreet number of radiating elements.
We should consider a planar aperture with a circular boundary being incised by a family of m concentric circles with N_{m} radiators. Using circular coordinates and applying some simple algebra we can obtain this two-variable Function:
$F(\theta, \phi) = 4 \sum_{m=1}^{20} \sum_{n=1}^{m} I_{m} \cdot \cos \left[\frac{\pi (2m-1)}{4}\cdot \cos\left(\frac{(2 n-1) \pi}{4m}\right) \sin (\theta) \cos (\phi)\right] \cdot \cos \left[\frac{\pi (2m-1)}{4} \sin \left(\frac{(2 n-1) \pi}{4m}\right) \sin (\theta) \sin (\phi)\right]$
Being m the number of circles (20 on this case), N_{m}=4m elements, I_{m} is the current, which has a certain value for each circle and \phi and \theta being the spherical coordinates angles (taking values from -\pi to \pi and from 0 to \pi, respectively).
The fact is that I want to represent this function on a 3D graph. I am going to explain what I tried so far.
I decided to define \phi and \theta as numpy arrays with 50 values each one. Then I decided to create a 20x20 zero matrix, where the double sum calculations will be. Then I defined the double sum with a double loop.
The code I used was the following:
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
p=np.linspace(-np.pi, np.pi, 50) #phi angle
t=np.linspace(0,np.pi,50) #theta angle
F=np.zeros((20,20)) #matrix
I=np.array([1,0.961,0.851,0.689,0.510,0.377,0.360,0.429,0.497,0.521,0.494,0.427,0.340,0.257,0.199,0.178,0.181,0.191,0.200,0.204]) # I current array
for i in range(20):
for j in range(i):
F[i,j]= 4*I[i]*np.cos(np.pi*(2(i+1)-1)/4 * np.cos(np.pi*(2*(j+1)-1)/(4(j+1))) * np.sin(t)* np.cos(p)) * np.cos(np.pi*(2(i+1)-1)/4 * np.sin(np.pi*(2*(j+1)-1)/(4(j+1))) * np.sin(t)* np.sin(p))
ax = plt.axes(projection='3d')
ax.plot_surface(p, t, F, rstride=1, cstride=1,
cmap='viridis', edgecolor='none')
ax.set_title('surface');
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('F')
When running the file I have the following TypeError:'int' object is not callable
I do not know what it is going wrong or how could I improve the program in order to obtain the graph or even make it more efficient.