It is possible to know how meshgrid organize the points?

1 vue (au cours des 30 derniers jours)
Bárbara Matos
Bárbara Matos le 8 Juin 2022
Commenté : William Rose le 4 Juil 2022
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 commentaires
KSSV
KSSV le 8 Juin 2022
Copy and paste your code here.
Bárbara Matos
Bárbara Matos le 8 Juin 2022
Modifié(e) : Bárbara Matos le 8 Juin 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!

Connectez-vous pour commenter.

Réponse acceptée

William Rose
William Rose le 1 Juil 2022
Modifié(e) : William Rose le 1 Juil 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 commentaires
Bárbara Matos
Bárbara Matos le 3 Juil 2022
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 :))
William Rose
William Rose le 4 Juil 2022
@Bárbara Matos, you're welcome, and thank you for accepting the answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by