필터 지우기
필터 지우기

It is possible to know how meshgrid organize the points?

조회 수: 2 (최근 30일)
Bárbara Matos
Bárbara Matos 2022년 6월 8일
댓글: William Rose 2022년 7월 4일
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
KSSV
KSSV 2022년 6월 8일
Copy and paste your code here.
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 :))
William Rose
William Rose 2022년 7월 4일
@Bárbara Matos, you're welcome, and thank you for accepting the answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by