It is possible to know how meshgrid organize the points?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bárbara Matos
am 8 Jun. 2022
Kommentiert: William Rose
am 4 Jul. 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 Kommentare
Akzeptierte Antwort
William Rose
am 1 Jul. 2022
Bearbeitet: William Rose
am 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);
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!