It is possible to know how meshgrid organize the points?

1 次查看(过去 30 天)
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 个评论
Bárbara Matos
Bárbara Matos 2022-6-8
编辑:Bárbara Matos 2022-6-8
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!

请先登录,再进行评论。

采纳的回答

William Rose
William Rose 2022-7-1
编辑:William Rose 2022-7-1
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 个评论
Bárbara Matos
Bárbara Matos 2022-7-3
Thank you very much for your help! I understood how sphere() works, but I am not sure that it is the best option for me. I will try some modifications based on what you said. Thanks again :))

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by