Monthly Archives: March 2014

Direction Of Arrival simulation with Nec2

This paper presents the method used for simulation of an Uniform Linear Array in 4Nec2 program and the results that are obtained by using the array output in Matlab with DOA methods rootMusic, Esprit, wsf, beamscan, MVDR. For increasing resolution, mutual coupling impedances for the array are calculated with 4Nec2 program and subsequently used to correct the output of the array. The absolute error is plotted for both cases, with mutual coupling correction and without mutual coupling correction.

Method of simulation of Uniform Linear Array array and signal source impinging on the array:

A simple ULA array of dipoles is simulated in 4Nec2 and the source of the signal is a similar dipole excited by a voltage source modulated in amplitude by a cos() function. In order to have a closer to reality simulation, the voltage source is modulated in amplitude by a low frequency signal that is sampled at a sampling frequency fs. One simulation is run for each sample of the voltage so that the response of the array is obtained for each of the sample.

The ULA is presented in the following picture:

Calculating the mutual impedance matrix:

The literature of antenna array makes distinction between the mutual impedance for transmitting arrays for which the elements are excited and produce electromagnetic field and the mutual impedance for receiving arrays in which the source of the electromagnetic field is outside of the array – see Yantao et all in [Ref1].

The mutual correction matrix used to obtained uncoupled voltages (U) form the coupled voltages (V) is presented below:

Here the mutual impedances between antenna 1 and 2, Z12, is calculated by Z12 = – (V1 – U1)/I2 where V1 is the voltage on the antenna 1 when antenna 2 is existing and connected to ZL impedance and U1 is the uncoupled voltage in antenna 1 with antenna 2 removed. I2 is the current in the antenna 2. This is the correction matrix used in our simulations and below is presented as a reference the transmitting correction matrix that is deducted when the antenna array elements are emitting electromagnetic field:

The above formula relates Vo which is the open circuit voltage to the coupled voltages, assuming that the open circuit voltage is independent of the mutual coupling.

Practical results:

The ULA array is formed by 9 dipoles resonating at around 430Mhz frequency. The dipoles are separated by 0.2m which is a distance lower than lambda/2=0.4836/2 meter so a strong mutual coupling between array elements is expected. In the Nec2 model each dipole has 9 segments and a 50 Ohm impedance is connected on segment 5. The source is a far source modeled as a dipole placed at 10km distance and powered by a voltage source modulated by a 300hz cosine source sampled at fs=8000Hz.

A sweep with a resolution of 5 degrees azimuth (xy plane) is executed by placing the source at an azimuth between -85 to +85 degrees angle in the far field and calculating the array output. A set of Nec2 models is created by having one .nec file for each azimuth angle and each sample, e.g. the file represents the model with a source placed at -40 degrees azimuth in the far field and with the voltage source exciting the transmitting dipole representing the 7999th sample.

Therefore, the set of input .nec files is of size (85×2 + 1) * 8000 = 136800. Correspondingly the set of output files is of the same size.

A set of tools was created to parse the .out files and create one file for each azimuth degree which are in turn imported into Matlab as antenna array output.

The correction matrix is calculated by running a simulation with the source placed in far field at zero degree azimuth and calculating Zxy by running simulations with antenna x and with antenna y placed in the model and then with antenna x and antenna y taken out from the model. Another tool is created to parse the output of the 4Nec2 program and generate a file containing the 9×9 correction matrix which in turn is imported in Matlab.

A set of plots is presented below for a set of DOA algorithms with and without mutual coupling correction:

It can be seen that the mutual coupling compensation is useful for azimuth in range -80 to -15 and 15 to 80 degrees. For the rest of the situations the DOA error is lower in the case of not using correction. It will be of interest to test the simulation results in real life situation.

Many sources DOA:

Two simulations has been run with two signal sources of frequency 300Hz respective 400Hz that modulates in amplitude the 430Mhz carrier. The first one has the sources placed at -30 and +45 degree azimuth and the second has the sources at +17 respective +22 degrees.

The following table shows the DOA results with two sources for the case of uncorrected array output and corrected output:

It can be seen that when the sources are separated by a relatively small angle (5 degree in our second simulation) only rootMusic and Esprit algorithms can determine the two signal directions but even in this situation the error is bigger and generate an increase of the detected angle between the two sources.


  • The method of using Nec2 MoM program to simulate the antenna array and obtain the array manifold provides good insights on the mutual coupling compensation versus azimuth and elevation. The exciter signal can be modeled by having any modulation type and also the multipath effects can be simulated.
  • Receiving of different number of samples can be simulated.
  • Using the mutual coupling compensation improve the precision of DOA for absolute azimuth angles that satisfy the approximate relationship: 15 < |az| < 80.
  • The theory developed for ULA can be applied also for Uniform Circular Array (UCA) if transformation is done from UCA to ULA so that the steering vector becomes a Vandermonde matrix. This will be shown in another paper.

A word about tools:

  • 4Nec2 MoM tool was used during the simulation. It uses Nec2 core and is created for running under Windows but can run just fine on Linux (Ubuntu 12.04) using wine. The tools generate a .bat files that will be executed in windows console under wine.
  • The method of creating model files for each sample and each azimuth value is inneficient from computing time point of view. As an example, running the whole azimuth sweep -85, 85 and whole sample range 0-7999 takes 2 days execution time on a SandyBridge core i7 at 3.4Mhz. Therefore a way to run the 4Nec2 in an multithreaded fasion is a must in order to decrease the computing time.


[Ref1] Yantao Yu, Hoi-Shun Lui , Choon Hock Niow , Hon Tat Hui – Improved DOA Estimations Using the Receiving Mutual Impedances for Mutual Coupling Compensation: An Experimental Study

[Ref2] github code for tools:

[Ref3] 4Nec2 is created by Aries Voors: