cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to draw a full sphere

hyener
1-Visitor

How to draw a full sphere

Hi,

I have drawn a sphere (you can find the attached file), but the data points are on the surface. I want a full sphere. As an example I drew only @r=3 and @r=5

My first question is, I don't have an idea why we write λ(Θ,ϕ) <-- F(r,0,0,0,Θ,ϕ) on the 3D scatter plot. Why cannot we write F(r,0,0,0,Θ,ϕ) on the graph?


I tried to write a for loop for the radius (r=0, r=0.1 .... r=n) and i want to see all the spheres on the graph.

One more important point is that I need the x,y,z coordinates for these spheres but even for one single sphere I cannot see the coordinates of the data points.

So to sum up,

I have the code that draws a sphere but it only draws the data points on the surface, I need a full sphere. And, I need the coordinates of these data points. Could you please help me?

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:hyener)

If you really wish to do this, here you go. It's going to take a while to calculate 200 spheres though.

View solution in original post

16 REPLIES 16
LucMeekes
23-Emerald III
(To:hyener)

Side note.

You have an error in the definitions of y() and z(), their definitions on the rhs use y0 and z0 respectively, but their parameter lists use x0...

Luc

Oh, yes I corrected it thank you.

Do you know how to solve my problem?

LucMeekes
23-Emerald III
(To:hyener)

Like this?

Success!
Luc

Oh, and the matrix X holds all the x-values of the datapoints (for each of the indexes i and j), matrix Y holds the corresponding y-values and Z...

First, thank you so much for your effort.

This another great way to draw sphere but it still only shows the points on the surface just for 1 radius value.

I mean it is not a continuous function for radius.

See the screenshot attached, it is only for r=1 and r=3.

Actually I need a graph that gives me thousands of spheres with different r's such as r=0, 0.1, 0.2 .... 2.8, 2.9, 3.0

PS: This way clearly solves the problem to see the coordinates X,Y,Z thank you for that.

I think I may need a for loop for various r values.

a2.PNG

LucMeekes
23-Emerald III
(To:LucMeekes)

Further:

Thank you again,

However, I will process hundreds of r values from 0 to 25 with delta r = 0.01 (this is just an assumption, values may vary)

So, I cannot write on the graph manually like: (x1,y1,z1),(x2,y2,z2),....(x249,y249,z249),(x250,y250,z250)

RichardJ
19-Tanzanite
(To:hyener)

Why do you want to see a filled sphere? You can just draw the shell and change the properties of the plot to make it look solid. Why does that not work for you?

hyener
1-Visitor
(To:RichardJ)

Yes of course I know that I can make the sphere look solid, but the points on the surface are not enough for my project.

I am gonna make something about diffusion (and bulk degradation in the future) and so i will assign the properties of every coordinate in the sphere not just for the surface.

So, by making radius continous i will approximately make a full sphere and I will get the x,y,z coordinates for a full sphere. Then, i will make mathematical calculations next.

RichardJ
19-Tanzanite
(To:hyener)

OK. I can many reasons why you would need the coordinates of points throughout the sphere, but that wasn't my question. My question was why you need to plot them all.

hyener
1-Visitor
(To:RichardJ)

I do not know how to make mathemical operations on the data points in the sphere while they do not exist.

By the way, yeah this is not my question, too.

LucMeekes
23-Emerald III
(To:hyener)

What do you mean by 'exist'?

If the sphere is a physical reality, then all points within it exist, but also all points outside of it.

But the sphere does not need to exist in order for you to calculate properties for any point within a sphere, as long as you have a model.

Luc

But when we use this model, let r=1


There wont be any points inside the sphere, will there? the points are on the surface.

So, I also want to see a sphere @r=2 and @r=3 and .... r=20

So as a result i will have a sphere @r=20 but full inside. Am I wrong?

Even if I am wrong, I need to draw a graph that consists many spheres from r=0 to r=20 (let delta r=0.1, in total there will be 200 spheres)

My question is how can draw 200 spheres on 1 graph automatically.

LucMeekes
23-Emerald III
(To:hyener)

Have you thought about the limitations:

- to depict 3-dimensional objects on just two dimensions at all.

- to depict many 3-dimensional objects where the outer ones are covering the inner ones, so what is there to be seen from the inner ones...?

Luc

RichardJ
19-Tanzanite
(To:hyener)

If you really wish to do this, here you go. It's going to take a while to calculate 200 spheres though.

hyener
1-Visitor
(To:RichardJ)

Oh, thank you so much

RichardJ
19-Tanzanite
(To:hyener)

There was a bad bug in that (more than one in fact). Here's a new version.

Announcements

Top Tags