# What are the point locations for EHfields() function output?

7 views (last 30 days)
Xingda Chen on 19 Jan 2024
Commented: Maxime on 19 Mar 2024
When I run the EHfields function like this:
[e,h] = EHfields(antenna_object,frequency)
The size of the output e is 3 * 441. Where 3 is the x,y and z component of the computed electric field.
When I run the function like this:
[eh,~]=EHfields(antenna_object,frequency, Polarization="H");
The size of the output eh is 1 * 441. Where 1 is the horizontal compoenent of the computed electric field.
My question is the 441. I am guessing that it is the index of the points evaluated as a unit sphere around the antenna. But in what ordered are they counted?
From Antenna Toolbox Coordinate Sytem it could be that it is counted from the azimuth angle from the positive x-axis to the vector's orthogonal projection onto the xy plane, moving in the direction towards the y-axis and ranges from –180 and 180 degrees, and the elevation angle from the vector's orthogonal projection on the xy plane toward the positive z-axis and ranges from –90 and 90 degrees.
But I don't know for sure. I cannot find documentation clearifying how exactly are these points ordered, spaced and located. Perhaps a staff's answer can be much helpful?
Thanks

David Goodmanson on 20 Jan 2024
Edited: David Goodmanson on 21 Jan 2024
Hi XC,
I don't have the antenna toolbox but there are definite indications that they are using the sphere command. Sphere has a default of 20 for its argument, which creates grids with 21x21 points. Suppose
[xs ys zs] = sphere(20);
then
th1 = linspace(pi,0,21);
phi1 = linspace(-pi,pi,21);
[phi th] = meshgrid(phi1,th1);
x = sin(th).*cos(phi);
y = sin(th).*sin(phi);
z = cos(th);
reproduces the sphere result. Taking a smaller case
th1 = linspace(pi,0,5);
phi1 = linspace(-pi,pi,5)
[phi th] = meshgrid(phi1,th1)
phi =
-3.1416 -1.5708 0 1.5708 3.1416
-3.1416 -1.5708 0 1.5708 3.1416
-3.1416 -1.5708 0 1.5708 3.1416
-3.1416 -1.5708 0 1.5708 3.1416
-3.1416 -1.5708 0 1.5708 3.1416
th =
3.1416 3.1416 3.1416 3.1416 3.1416
2.3562 2.3562 2.3562 2.3562 2.3562
1.5708 1.5708 1.5708 1.5708 1.5708
0.7854 0.7854 0.7854 0.7854 0.7854
0 0 0 0 0
verfies that phi goes from -pi to pi along each row, and that theta goes from pi to zero down each column.
x =
-0.0000 0.0000 0.0000 0.0000 -0.0000
-0.7071 0.0000 0.7071 0.0000 -0.7071
-1.0000 0.0000 1.0000 0.0000 -1.0000
-0.7071 0.0000 0.7071 0.0000 -0.7071
0 0 0 0 0
y =
-0.0000 -0.0000 0 0.0000 0.0000
-0.0000 -0.7071 0 0.7071 0.0000
-0.0000 -1.0000 0 1.0000 0.0000
-0.0000 -0.7071 0 0.7071 0.0000
0 0 0 0 0
z =
-1.0000 -1.0000 -1.0000 -1.0000 -1.0000
-0.7071 -0.7071 -0.7071 -0.7071 -0.7071
0.0000 0.0000 0.0000 0.0000 0.0000
0.7071 0.7071 0.7071 0.7071 0.7071
1.0000 1.0000 1.0000 1.0000 1.0000
so you can determine the locations, if this is indeed what EHfields is doing.
Xingda Chen on 30 Jan 2024
Thank you David, for the elaborate answer. My apologies for taking so long to accept.

### More Answers (1)

Maxime on 13 Mar 2024
Hello there,
Your answer was hepful to understand a bit more about the output of EHfields. Still I don't see how the 3-by-p output is arranged in detail. Is azimuth fixed and then elevation varies ? Then building a matrix where the first 21 components are the elevation for a fixed azimuth, the 21 next are the components for a new azimuth fixed and all elevation, etc..
Thank you,
Maxime H.
##### 2 CommentsShow NoneHide None
David Goodmanson on 18 Mar 2024
Hello Maxime,
Whether you get 3x441 or 1x441 is up to the details of EHfields output and I do not have access to that function. But suppose you consider the transpose of those to get 441x3 or 441x1. What is quite likely happening is that the function creates 21x21 matrices for phi and theta and then reads those matrices out columnwise to get the 441. Using the 5x5 example above, then
phicol = phi(:)
reads out the 5x5 columnwise into a 1x25 column. Similarly with
thcol = thl(:)
for theta. For display purposes here,
phiandtheta = [phicol thcol]
puts those two columns side by side:
phiandtheta =
-3.1416 3.1416
-3.1416 2.3562
-3.1416 1.5708
-3.1416 0.7854
-3.1416 0
-1.5708 3.1416
-1.5708 2.3562
-1.5708 1.5708
-1.5708 0.7854
-1.5708 0
0 3.1416
0 2.3562
0 1.5708
0 0.7854
0 0
1.5708 3.1416
1.5708 2.3562
1.5708 1.5708
1.5708 0.7854
1.5708 0
3.1416 3.1416
3.1416 2.3562
3.1416 1.5708
3.1416 0.7854
3.1416 0
If you had phicol and no longer had the 5x5 matrix phi, you could get it back with
phi = reshape(phicol,5,5)
which reads it back in columnwise.
As to the antenna toolbox, is it doing
th1 = linspace(pi,0,21);
phi1 = linspace(-pi,pi,21);
[phi th] = meshgrid(phi1,th1);
which reproduces the output of the sphere command? I don't know. I suppose the antenna toolbox documantation tells you. Failing that, you do have the field components in 441x1 columns, and for a given dipole source and field component you could reshape those to 21x21 and see what makes sense.
Maxime on 19 Mar 2024
Thank you for this complete answer.

### Categories

Find more on Antenna and Array Analysis in Help Center and File Exchange

R2023a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!