how to plot a sphere with center(6500000,6500000,6500000) and radius 650000

 採用された回答

Akira Agata
Akira Agata 2018 年 10 月 15 日

1 投票

How about this?
[x,y,z] = sphere;
x = x*650000;
y = y*650000;
z = z*650000;
figure
surf(x+650000,y+650000,z+650000)

1 件のコメント

GEORGIOS TSAKIRAKIS
GEORGIOS TSAKIRAKIS 2018 年 10 月 16 日
thank you very much! it works perfect

サインインしてコメントする。

その他の回答 (2 件)

Image Analyst
Image Analyst 2018 年 10 月 15 日

1 投票

Try this:
% Make unit sphere
[x,y,z] = sphere;
% Scale to desire radius.
radius = 650000;
x = x * radius;
y = y * radius;
z = z * radius;
% Translate sphere to new location.
offset = 6500000;
% Plot as surface.
surf(x+offset,y+offset,z+offset)
% Label axes.
xlabel('X', 'FontSize', 20);
ylabel('Y', 'FontSize', 20);
zlabel('Z', 'FontSize', 20);
axis equal;

8 件のコメント

GEORGIOS TSAKIRAKIS
GEORGIOS TSAKIRAKIS 2018 年 10 月 16 日
thank you very much! it works perfect
Ravi Singh
Ravi Singh 2020 年 3 月 3 日
Hii Image Analyst,
i have drawn the sphere from the given coordinates and radius , now i want to check the pixel value of color map so that i can verify if some pixels are present inside the sphere or not .
Image Analyst
Image Analyst 2020 年 3 月 3 日
Just check the distance from the offset or center
distance = sqrt((x-xCenter).^2+(y-yCenter).^2+(z-zCenter).^2);
if distance is less than the radius, it's inside.
M.S. Khan
M.S. Khan 2020 年 4 月 2 日
Hi Image Analyst, could you please explain, what is xCenter?
Image Analyst
Image Analyst 2021 年 11 月 21 日
@M.S. Khan xCenter is the x location of the center of the sphere. For the example I gave it's 6500000.
@Jeson Lonappan, you can't get them from this. It's not the earth. And there is mo Merdian line defined so there is no absolute longitude. Any point on the sphere could therefore be any longitude.
Alberto Acri
Alberto Acri 2024 年 1 月 24 日
編集済み: Alberto Acri 2024 年 1 月 24 日
Hi @Image Analyst! How can I extract the coordinates of the sphere nodes? The x,y,z matrices are 21x21 doubles. I would like to use plot3!
Image Analyst
Image Analyst 2024 年 1 月 24 日
I don't know from that function, but you can of course easily generate your own coordinates on the shell of the sphere. For any given z value, it's simply a circle. See the FAQ:
DGM
DGM 2024 年 1 月 24 日
See also:
That is one way to use plot3() to draw a spherical shell. Once you have the x,y,z data, you can offset it to the desired center.
If it's not actually necessary to use plot3() specifically, or if the sphere needs to be drawn in some other manner, then you'll have to say.

サインインしてコメントする。

Ankita De
Ankita De 2022 年 7 月 11 日

0 投票

can you please tell nearest neighbour and contact distance distribution using binomial point process

カテゴリ

タグ

質問済み:

2018 年 10 月 15 日

コメント済み:

DGM
2024 年 1 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by