0
votes

I have matrix A with size 5x3 which includes 3D (X,Y,Z) coordinates of some points and these points should be center of the spheres. and a vector B with size 5x1 which includes radius of each sphere. How can I plot the spheres around the points with defined radius in vector B and defined center in Matrix A?

1

1 Answers

1
votes

Form Matlab docs

Description The sphere function generates the x-, y-, and z-coordinates of a unit sphere for use with surf and mesh.

sphere generates a sphere consisting of 20-by-20 faces.

sphere(n) draws a surf plot of an n-by-n sphere in the current figure.

You'll need to scale those points by the radius of your sphere and translate them to the appropriate centre. Then plot them. 10 seconds of searching matlab documentation gave me the code to do that as well as to plot the spheres using the surf command.

surf Create 3-D shaded surface plot