It is possible to know how meshgrid organize the points?

3 views (last 30 days)
Hello!
I am creating a sphere of points like it is shown in image 1. The ideia is now, for each point, calculate the value of the electric field. That part is in image 2 and you can consider that the calculations are correct. After this, I want to plot the radiation filed with patternCostum, and for that, I need to have the electric field (E_points) organized in a matrix. As I have 10000 points, when I traverse the array of points to calculate the field the E_points array also have 10000x1 points. So I reshape it and then do the patternCostum(). - image 3.
The correct patternCostum is presented in image 4. It seems that my patternCostum is correct, but some E_points doesn't match with the Phi_points and Theta_points arrays. It is possible somehow know which point correspond to each theta and phi? Or the are some easier option?
Thank you a lot!
  2 Comments
Bárbara Matos
Bárbara Matos on 8 Jun 2022
Edited: Bárbara Matos on 8 Jun 2022
I send you a weTransfer link because you also need a .ffs and a struct AntArr which I have from a GUI on appDesigner.
Thank you very much!

Sign in to comment.

Accepted Answer

William Rose
William Rose on 1 Jul 2022
Edited: William Rose on 1 Jul 2022
I think the following code illustrates how the points returned by sphere() are arranged. See comments below.
[xs,ys,zs]=sphere(4);
disp(xs); disp(ys); disp(zs);
0 0 0 0 0 -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 0 0 0 0 0 0 -0.7071 0 0.7071 0 0 -1.0000 0 1.0000 0 0 -0.7071 0 0.7071 0 0 0 0 0 0 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -0.7071 -0.7071 -0.7071 -0.7071 -0.7071 0 0 0 0 0 0.7071 0.7071 0.7071 0.7071 0.7071 1.0000 1.0000 1.0000 1.0000 1.0000
sphere(n) returns 3 matrices which are the x, y, and z coordinates of a n+1 by n+1 rectangular grid wrapped around the sphere. Suppose the z axis is the Earth's axis of rotation and +x goes through the Greenwich meridian and +y goes through 90 East. Then row 1 of each array corresponds to the south pole (theta=+pi, where theta is the polar angle, measured from th +z axis, as in the physics convention in the wikipedia article on spherical coordinates). The middle row is the equator (theta=+pi/2). Row n+1 corresponds to the north pole (theta=0). Column 1 corresponds to the international date line (phi=-pi, where phi is the azimuthal angle, measured CCW in the x-y plane, as in the physics convention in the diagram in Wikipedia for spherical coordinates), then the columns go east (phi increasing). The middle column corresponds to the Greenwich meridian (phi=0) and the last column is the date line again (phi=+pi). Good luck with your work.
  2 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by